You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Capture exceptions from OpenTelemetry span events #16015
I would like to request a way to capture exceptions from OpenTelemetry span events as Sentry errors in my NestJS application. Currently, exceptions that occur and are recorded in OpenTelemetry spans are not being converted to Sentry errors, which limits my error tracking capabilities.
According to the SDK documentation (https://develop.sentry.dev/sdk/telemetry/traces/opentelemetry), exceptions from span events should be converted to Sentry errors. I noticed this feature was removed in PR #11221 with a mention that it might return as an opt-in feature in the future.
An opt-in approach would allow users who need this functionality to enable it while not affecting those who don't require it. This would be incredibly helpful for my error monitoring workflow.
Hey, thanks for raising this. Yes, I think it makes sense to re-add this as an opt-in option! PRs are welcome, I'll put this in the backlog as we are currently pretty swamped with work.
When the SDK registers its tracer provider (enableOpenTelemetrySetup: true), spans started through @opentelemetry/api are Sentry spans, so instrumentation hands the exception straight to span.recordException(), which is a no-op today.
Proposed shape:
An opt-in spanExceptionsIntegration() in @sentry/core, exported from the server SDKs.
With it, recordException(exception) on any span, sampled or not, captures the original exception as an error linked to that span, with mechanism auto.core.span_exceptions and handled: true.
An exception the SDK already captured is skipped by the existing already-captured check. Nothing is captured while tracing is suppressed, for example while the SDK sends its own events.
Hand-written addEvent('exception', ...) events and spans from a tracer provider you register yourself are out of scope.
Activity
mydea commentedon Apr 9, 2025
Hey, thanks for raising this. Yes, I think it makes sense to re-add this as an opt-in option! PRs are welcome, I'll put this in the backlog as we are currently pretty swamped with work.
ckblockit commentedon Mar 19, 2026
subscribing and thumbs up for this feature
Lms24 commentedon Mar 20, 2026
PRs are still welcome :)
xcscxr commentedon Nov 4, 2026
I'd like to pick this up.
When the SDK registers its tracer provider (
enableOpenTelemetrySetup: true), spans started through@opentelemetry/apiare Sentry spans, so instrumentation hands the exception straight tospan.recordException(), which is a no-op today.Proposed shape:
spanExceptionsIntegration()in@sentry/core, exported from the server SDKs.recordException(exception)on any span, sampled or not, captures the original exception as an error linked to that span, with mechanismauto.core.span_exceptionsandhandled: true.addEvent('exception', ...)events and spans from a tracer provider you register yourself are out of scope.Happy to rename it if you prefer another name.
andreiborza commentedon Nov 6, 2026
We decided to not add this at the moment. Span events are deprecated in OTel and there hasn't been much demand for this.