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 is driven primarily by the standard OpenTelemetry SDK environment variables — the same ones used across every OTel language SDK. You set them in your .env file, your container environment, or through the bundle’s sdk: configuration section. A small number of Symfony-specific options supplement the standard set.

Environment variable reference

VariableExample valueDescription
OTEL_PHP_AUTOLOAD_ENABLEDtrueEnables SDK auto-initialization. Must be true for the bundle’s instrumentation to emit signals. See the SDK Setup guide if DotEnv timing causes this to be set too late.
OTEL_SERVICE_NAMEmy-symfony-appThe service name shown in your observability backend (Jaeger, Tempo, Traceway, etc.).
OTEL_TRACES_EXPORTERotlpTraces exporter. Accepted values: otlp, zipkin, console, none.
OTEL_LOGS_EXPORTERotlpLogs exporter. Accepted values: otlp, console, none. Only used when logs.export.enabled: true in bundle config.
OTEL_METRICS_EXPORTERotlpMetrics exporter. Accepted values: otlp, console, none. Only used when metrics.enabled: true in bundle config.
OTEL_EXPORTER_OTLP_ENDPOINThttp://localhost:4318Base URL of your OTel Collector or backend OTLP endpoint. The bundle automatically excludes this host from HTTP client tracing to prevent trace loops.
OTEL_EXPORTER_OTLP_PROTOCOLhttp/jsonWire protocol for the OTLP exporter. Accepted values: http/json, http/protobuf, grpc. The grpc value requires additional packages — see gRPC transport below.
OTEL_EXPORTER_OTLP_METRICS_ENDPOINThttp://localhost:4318/v1/metricsOverride the OTLP endpoint specifically for metrics. Useful when your metrics backend uses a different address than your traces and logs backend.
A typical .env.local for local development looks like this:
OTEL_PHP_AUTOLOAD_ENABLED=true
OTEL_SERVICE_NAME=my-symfony-app
OTEL_TRACES_EXPORTER=otlp
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/json
Use OTEL_EXPORTER_OTLP_PROTOCOL=http/json unless you have ext-protobuf installed. The pure-PHP JSON serialiser works out of the box and is the safest default for most Symfony deployments.

gRPC transport

The bundle ships only the pure-PHP OTLP transports (http/json and http/protobuf). To use OTEL_EXPORTER_OTLP_PROTOCOL=grpc you must install two additional pieces:
  • ext-grpc — the PHP gRPC PECL extension
  • open-telemetry/transport-grpc — the Composer package that wires ext-grpc into the OTel PHP SDK
ext-protobuf is also strongly recommended alongside gRPC; without it the SDK falls back to a slower pure-PHP protobuf implementation.
pecl install grpc
composer require open-telemetry/transport-grpc
Then set your protocol:
OTEL_EXPORTER_OTLP_PROTOCOL=grpc
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
gRPC endpoints use port 4317 by convention, while HTTP/JSON and HTTP/Protobuf use port 4318. Make sure your endpoint URL and protocol match.
After installing, run the Traceway doctor command to verify that all required pieces are present:
bin/console traceway:doctor
The doctor command warns if grpc is selected as the protocol but ext-grpc or open-telemetry/transport-grpc is missing, helping you catch misconfiguration before it reaches production.
Do not set OTEL_EXPORTER_OTLP_PROTOCOL=grpc in production without first confirming that both ext-grpc and open-telemetry/transport-grpc are available in that environment. A missing transport silently falls back or throws at runtime.

Full SDK variable list

The variables listed above cover the most common Symfony use cases. The OpenTelemetry PHP SDK supports a much larger set of environment variables for configuring sampling, propagation, batch export timeouts, resource detectors, and more.

OpenTelemetry PHP SDK documentation

Full list of supported environment variables and exporters for the PHP SDK.

Build docs developers (and LLMs) love