Sentry Support#
Unfortunately, Sentry does not fully support OpenTelemetry. Specifically, Sentry uses its own context format, which does not work well with Python implementations. The depth of cached spans is insufficient to properly bind to the root
span.
OpenTelemetry Collector#
Fortunately, there is a workaround for exporting spans to Sentry. You just need to launch the opentelemetry-collector
container, which will convert the traces to the Sentry format and export them according to the specified DSN
.
-
Install opentelemetry-exporter-otlp to export spans via gRPC:
-
Setup the
TracerProvider
with gRPC exporter: -
Create an
otel.yaml
configuration file with your SentryDSN
: -
Run the Docker container with the
opentelemetry-collector
:
Note
While this setup is somewhat limited due to the lack of full support from the sentry-sdk
, your code remains independent of the tracing backend. You can switch to Tempo or Jaeger at any time by simply updating otel.yaml
.
Visualization#
An example of a distributed trace visualization between two services in Sentry.
Alternatives#
If you're looking for a tracing and visualization system that is easy to configure and does not require additional infrastructure, consider Logfire.