Skip to main content

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.

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.

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.
ComponentSpan KindWhat’s Captured
HTTP requestsSERVERRoute templates (GET /api/items/{id}), status codes, body sizes, client IP, exceptions, sub-requests
Console commandsSERVERCommand name, arguments, exit code, exceptions
HttpClientCLIENTOutgoing requests with W3C context propagation, OTLP endpoint auto-excluded, re-entrance guard
MessengerPRODUCER / CONSUMERMessage class, transport, W3C context propagation across async boundaries
SchedulerCONSUMERSchedule name, trigger, next-run time, cancellation marker. Requires symfony/scheduler
MailerPRODUCER + CLIENTTwo-span split on MailerInterface::send and the transport. Recipient count, message-id, X-Transport routing
Doctrine DBALCLIENTParameterised SQL, transactions, db system/namespace auto-detection. DBAL 3.6+ and 4.x CI-tested
CacheINTERNALget (hit/miss), delete, invalidateTags with pool name. Requires symfony/cache
TwigINTERNALTemplate name, nested includes. Requires twig/twig
Monologtrace_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.
RequirementVersion
PHP>= 8.1
Symfony6.4 LTS, 7.x, 8.x
Doctrine DBAL3.6+ and 4.x (both CI-tested)
C extensionNot required — pure PHP throughout
ext-protobuf is optional but recommended for production deployments. It significantly speeds up protobuf serialization when using OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf, but the bundle works correctly without it using http/json.

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.

Build docs developers (and LLMs) love