bedita / instrumentation
OpenTelemetry instrumentation plugin for BEdita
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- php: ^8.1
- ext-opentelemetry: *
- bedita/api: ^5.30.0
- bedita/core: ^5.30.0
- cakephp/cakephp: ^4.5.0
- open-telemetry/api: ^1.1
- open-telemetry/opentelemetry-auto-cakephp: ^0.0.3
- open-telemetry/opentelemetry-auto-pdo: ^0.0.15
- open-telemetry/opentelemetry-auto-psr16: ^0.0.3
- open-telemetry/opentelemetry-auto-psr3: ^0.0.7
- open-telemetry/sem-conv: ^1.27
Requires (Dev)
- cakephp/cakephp-codesniffer: ^5.1
- open-telemetry/sdk: ^1.1
- phpstan/phpstan: ^1.12
- symfony/http-client: ^7.1
Suggests
- ext-grpc: Required to use gRPC as transport for the OTLP exporter
- ext-protobuf: Significant performance improvement for otlp+protobuf exporting
- ext-zlib: If you want to compress exported data
- open-telemetry/opentelemetry-auto-psr15: OpenTelemetry auto-instrumentation for PSR-15 (HTTP Server Request Handlers)
README
This library provides auto-instrumentation for BEdita applications, according to OpenTelemetry specifications.
Requirements
This library requires PHP 8.1+ and the OpenTelemetry PHP extension.
Other optional requirements:
ext-grpc
required to use gRPC as transport for the OTLP exporterext-protobuf
significant performance improvement for otlp+protobuf exportingext-zlib
if you want to compress exported dataopen-telemetry/opentelemetry-auto-psr15
auto-instrumentation for CakePHP middlewares (PSR-15)
Installation
composer require bedita/instrumentation
Note that installing this library by itself does not generate traces. You need to install and configure the OpenTelemetry SDK and at least an exporter:
composer require open-telemetry/sdk open-telemetry/exporter-otlp
Configuration
OpenTelemetry's auto-instrumentation is completely configurable through environment variables. See the SDK configuration documentation and the PHP-specific documentation.
This library provides the following instrumentations, which can be enabled or disabled individually using their respective names:
bedita
main instrumentation (currently does nothing by itself)bedita.client
CakePHP HTTP client (requiresbedita
)cakephp
CakePHP HTTP server, controllers and commands (project)pdo
PHP PDO (project)psr3
loggers compliant with PSR-3 standard (project)psr16
cache engines compliant with PSR-16 standard (project)
Example configuration
This configuration enables auto-instrumentation and the export of traces and logs using the otlp+protobuf protocol to a local backend:
# PHP injection export OTEL_PHP_AUTOLOAD_ENABLED=true # Export export OTEL_LOG_LEVEL="info" export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf" export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318/" # Tracing # export OTEL_TRACES_SAMPLER="parentbased_traceidratio" # export OTEL_TRACES_SAMPLER_ARG="0.1" export OTEL_PHP_DETECTORS="env,host,os,sdk" export OTEL_RESOURCE_ATTRIBUTES="service.namespace=my-namespace" export OTEL_SERVICE_NAME="my-service" # Propagation export OTEL_PROPAGATORS="tracecontext,baggage" # Instrumentation export OTEL_PHP_EXCLUDED_URLS="/status" # export OTEL_PHP_DISABLED_INSTRUMENTATIONS="pdo" # Log # see: https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/Instrumentation/Psr3#mode export OTEL_PHP_PSR3_MODE="export"