Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OTel] Expose context-aware methods for capturing events in public API #555

Open
tonyo opened this issue Jan 30, 2023 · 0 comments
Open
Labels
Status: Backlog Topic: OpenTelemetry Issue/PR related to OpenTelemetry integration Type: Feature

Comments

@tonyo
Copy link
Contributor

tonyo commented Jan 30, 2023

Extracted from #537.

Problem

Associating errors with transactions is generally implemented (see otel/event_processor.go), but there's a caveat: the EventHint of the event processor has to contain a valid Context with a set OpenTelemetry span. This means that e.g. messages captured with sentry.CaptureMessage or hub.CaptureMessage won't be linked to Sentry spans at the moment.

So to properly link the raised exception now users have to do things like:

	client := sentry.CurrentHub().Client()
	client.CaptureException(
		errors.New("test sentry exception"),
		&sentry.EventHint{Context: ctx},
		nil,
	)

Proposed Solution

We might want to expose methods like CaptureMessageWithContext(ctx context.Context, message string) and others that also take a ctx parameter. Under the hood, they would set add the passed ctx to EventHint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Backlog Topic: OpenTelemetry Issue/PR related to OpenTelemetry integration Type: Feature
Projects
None yet
Development

No branches or pull requests

1 participant