worldia / instrumentation-bundle
Symfony opentelemetry auto-instrumentation: requests, commands, messenger, doctrine.
Package info
github.com/worldia/instrumentation-bundle
Type:symfony-bundle
pkg:composer/worldia/instrumentation-bundle
Requires
Requires (Dev)
- doctrine/dbal: ^3.6 || ^4.0
- open-telemetry/gen-otlp-protobuf: ^1.0
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^10.5
- symfony/framework-bundle: ^7.4 || ^8.0
- symfony/http-client: ^7.4 || ^8.0
- symfony/messenger: ^7.4 || ^8.0
- symfony/monolog-bundle: ^3.7
- symfony/security-core: ^7.4 || ^8.0
- symfony/serializer: ^7.4 || ^8.0
- symfony/twig-bundle: ^7.4 || ^8.0
- worldia/coding-standards: ^1.0
Suggests
- open-telemetry/exporter-otlp: To export telemetry data to an OTLP compatible ingester (Jaeger, Tempo, Loki, etc.)
- symfony/monolog-bundle: To enable open-telemetry logging
This package is auto-updated.
Last update: 2026-06-19 12:33:53 UTC
README
Using the official OpenTelemetry SDK.
Features
- Minimal auto-instrumentation for requests, console commands, consumers and doctrine
- Trace context propagation from incoming requests to consumers and outgoing http calls
- Minimal metrics for requests, consumers and messages
- Trace context propagation for database requests (using
sqlcommenter)
Full working example
For a fully working example including Jaeger, Grafana, Tempo, Loki and Prometheus, check the example directory.
Installation and configuration
Install along your exporter implementation, eg. open-telemetry/exporter-otlp.
composer require worldia/instrumentation-bundle open-telemetry/exporter-otlp
Add to bundles.php.
return [ // Other bundles Instrumentation\InstrumentationBundle::class => ['all' => true], ];
Configure OTEL env vars. Replace <your-telemetry-collector> by yours, eg. jaeger, tempo, otel-collector, ...
OTEL_SERVICE_NAME=test-app OTEL_PHP_DETECTORS=none OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=Delta OTEL_EXPORTER_OTLP_PROTOCOL=http/json OTEL_EXPORTER_OTLP_ENDPOINT=http://<your-telemetry-collector>:4318
Enable the extension. See the complete configuration reference here or run bin/console config:dump-reference instrumentation.
instrumentation: ~ monolog: handlers: otel: type: service id: Instrumentation\Logging\OtelHandler