The OpenTelemetry Symfony Bundle brings full-stack observability to Symfony applications using pure PHP — no C extension, no native module, and no changes to your hosting environment. Install it with a single Composer command and every HTTP request, console command, outgoing HTTP call, Messenger job, database query, cache operation, and Twig render is automatically traced, with Monolog log records correlated to the active trace. Traces are exported over OTLP and work with any OpenTelemetry-compatible backend: Traceway, Jaeger, Zipkin, Datadog, Grafana Tempo, Honeycomb, AWS X-Ray, and more.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tracewayapp/opentelemetry-symfony-bundle/llms.txt
Use this file to discover all available pages before exploring further.
Feature Overview
Automatic Tracing
Zero-configuration instrumentation for HTTP, Console, HttpClient, Messenger, Scheduler, Mailer, Doctrine DBAL, Cache, and Twig. Drop the bundle in and traces appear immediately.
Manual Tracing
Inject
TracingInterface into any service for one-liner custom span creation. Compose spans hierarchically with a single callback API — no boilerplate span lifecycle management.Metrics
Opt-in OTel metrics for Messenger, Doctrine DBAL, HTTP server/client, and Mailer. Extend with
MeterRegistryInterface for custom counters and histograms.Log Correlation
Monolog processor injects
trace_id and span_id into every log record automatically. Opt-in OTel Logs API export ships log lines to your backend alongside traces.Doctor Command
bin/console traceway:doctor validates SDK wiring, environment variables, bundle configuration, and OTLP endpoint reachability — outputs plain text or JSON for CI pipelines.AWS X-Ray
Native X-Ray support via the
open_telemetry.propagator: xray and open_telemetry.id_generator: xray configuration keys. Requires open-telemetry/contrib-aws.What Gets Traced
Every instrumented component follows OTel semantic conventions and emits structured span attributes your backend can filter and aggregate.| Component | Span Kind | What’s Captured |
|---|---|---|
| HTTP requests | SERVER | Route templates (GET /api/items/{id}), status codes, body sizes, client IP, exceptions, sub-requests |
| Console commands | SERVER | Command name, arguments, exit code, exceptions |
| HttpClient | CLIENT | Outgoing requests with W3C context propagation, OTLP endpoint auto-excluded, re-entrance guard |
| Messenger | PRODUCER / CONSUMER | Message class, transport, W3C context propagation across async boundaries |
| Scheduler | CONSUMER | Schedule name, trigger, next-run time, cancellation marker. Requires symfony/scheduler |
| Mailer | PRODUCER + CLIENT | Two-span split on MailerInterface::send and the transport. Recipient count, message-id, X-Transport routing |
| Doctrine DBAL | CLIENT | Parameterised SQL, transactions, db system/namespace auto-detection. DBAL 3.6+ and 4.x CI-tested |
| Cache | INTERNAL | get (hit/miss), delete, invalidateTags with pool name. Requires symfony/cache |
| Twig | INTERNAL | Template name, nested includes. Requires twig/twig |
| Monolog | — | trace_id + span_id injected into every log record; opt-in OTel Logs API export with per-channel scope |
Server-Timing response headers are included automatically on every traced HTTP response, enabling browser DevTools waterfall integration at zero extra cost.
Compatibility
The bundle is designed to work across the full range of supported Symfony versions and requires no native PHP extensions.| Requirement | Version |
|---|---|
| PHP | >= 8.1 |
| Symfony | 6.4 LTS, 7.x, 8.x |
| Doctrine DBAL | 3.6+ and 4.x (both CI-tested) |
| C extension | Not required — pure PHP throughout |
Next Steps
Installation
Add the bundle to your Symfony project with Composer and register it in under a minute.
Quickstart
Configure five environment variables and send your first trace in minutes.
