Skip to content

[OTel] Implement better panic recovery #582

Open
@tonyo

Description

@tonyo

Summary

Capture panics in OpenTelemetry-instrumented code and send errors to Sentry.

Motivation

At the moment people have to manually defer sentry.Recover() or sentry.RecoverWithContext() calls to catch panics.
For OpenTelemetry-instrumented code, panics are handled inside Span.End(): https://github.com/open-telemetry/opentelemetry-go/blob/d68b05fbeecb0112da0b5614a78b0187a4a0ad7a/sdk/trace/span.go#L381-L398
So what we can do to access that error, is to inspect span events inside SentrySpanProcessor's OnEnd(), and then build and send a Sentry event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureIssue typeGoSDKTopic: OpenTelemetryIssue/PR related to OpenTelemetry integration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions