Sentry Exporter
The Sentry Exporter allows you to send traces to Sentry.
For more details about distributed tracing in Sentry, please view our documentation.
The following configuration options are supported:
dsn
: The DSN tells the exporter where to send the events. You can find a Sentry project DSN in the “Client Keys” section of the “Project Settings” section of a Sentry project.
environment
: When the value is set, it will set the event environment tag, so the event can be filtered accordingly in Sentry. Note that this applies to every single event that is processed by the Sentry Exporter.
insecure_skip_verify
: If it is set to true, then ssl certificates will not be checked. Useful for test purposes, as well as for Sentry installations deployed in private clouds.
Example:
exporters:
sentry:
dsn: https://key@host/path/42
environment: prod
insecure_skip_verify: true
See the docs for more details on how this transformation is working.
Known Limitations
Currently, Sentry Tracing leverages a transaction-based system, where a transaction contains one or more spans. The exporter will try to group spans from a trace under one or more transactions based on internal heuristics, but this may lead to the creation of transactions that contain only one or two spans. These transactions will still be viewable and associated under a single trace in the Sentry UI.
One consequence of this result is that very large traces with a large number of spans (500+) and only one root span might be split up into a large number of transactions. There are no current ways to work around this.
Associating with Sentry Errors
To associate OpenTelemetry spans with Sentry errors, you can set a trace context on the error event. Whenever you start a new trace, you can update the scope to reference a new trace_id
.
An example with Python but applies to any language that supports a Sentry SDK.
from sentry_sdk import configure_scope
with start_otel_span("start") as span:
ctx = span.get_context()
with configure_scope() as scope:
scope.set_context("trace", {"trace_id": ctx.trace_id})
with start_otel_span("child"):
# ...
Now if traces are ingested into Sentry, you can associate them to errors that occurred during the trace using the trace_id
. For a full list of the Sentry SDKs and platforms, please check the Sentry documentation.