OpenTelemetry (OTLP) for Symfony

Learn about using OTLP to automatically send OpenTelemetry Traces to Sentry using the Symfony SDK.

The OTLP integration configures the Sentry SDK to automatically send trace data instrumented by an OpenTelemetry SDK to Sentry's OpenTelemetry Protocol ingestion endpoint.

Install the required OpenTelemetry packages via Composer:

Copied
composer require \
  open-telemetry/sdk \
  open-telemetry/exporter-otlp

You need to configure both the OpenTelemetry and Sentry SDKs to get trace data.

For the OpenTelemetry SDK, you need to configure instrumentation you want to capture.

Add the OTLPIntegration to the integrations list in your Sentry bundle configuration:

config/packages/sentry.yaml
Copied
sentry:
  options:
    integrations:
      - Sentry\Integration\OTLPIntegration

The OTLPIntegration is registered as a service by the Sentry Symfony bundle automatically.

Under the hood, the OTLPIntegration sets up the following parts:

  • A SpanExporter that automatically configures the OTLP ingestion endpoint from your Sentry DSN. This enables tracing in Sentry. Note: Do not also set up tracing via the PHP SDK (i.e. do not set traces_sample_rate, traces_sampler, or enable_tracing).
  • Trace/Span linking for all other Sentry events such as Errors, Logs, and Metrics

Cross-service trace propagation uses OTel's default W3C traceparent headers and does not require additional configuration. See Exporters, Event Linking, and Propagation for details.

For details on available options (setupOtlpTracesExporter, collectorUrl), see the OTLP integration docs.

  • PHP: 8.1+
  • sentry/sentry-symfony: 5.10.0+
  • open-telemetry/sdk: 1.0+
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").