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

Scopes not always applied to exceptions captured from Activity.RecordException #2711

Closed
jamescrosswell opened this issue Oct 10, 2023 · 0 comments · Fixed by #2712
Closed
Assignees

Comments

@jamescrosswell
Copy link
Collaborator

Following on from #2690, there is a scenario that PR does not address if an exception occurs in the user's application.

If the exception bubbles out of our middleware our the normal Sentry exception handling mechanism will kick in in, so there's no problem.

However, if people use Activity.RecordException, we generate synthetic exceptions in our SentrySpanProcessor. This happens after Hub.RestoreScope is called however currently Hub.RestoreScope is only called for TransactionTracer spans... so if an exception occurs in a SpanTracer span, the Scope won't be restored properly before generating a synthetic exception and calling CaptureEvent... in which case the Scope won't be applied by SentryClient:

scope.Evaluate();
scope.Apply(@event);

We should probably just always restore the scope in the SentrySpanProcessor.OnEnd callback, prior to generating exceptions or finishing any spans/transactions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants