-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Tracing now works for SentryHttpMessageHandler even when there is no active transaction #3360
Conversation
…action is found on the scope
… is set on the scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we find a solution where there is no need to differentiate between Hub
and HubAdapter
? The hub
vs _realHub
thing makes my head spin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to work with Requests
? Afaik there needs to be a Span within the Transaction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to work with Requests? Afaik there needs to be a Span within the Transaction?
I think this is unrelated to the fix here. If it didn't work before, this won't break it.
Resolves #2931
Problem summary
This logic in the
SentryHttpMessageHandler
means spans only gets created bySentryHttpMessageHandler
if there is already an active transaction set on the scope.:sentry-dotnet/src/Sentry/SentryHttpMessageHandler.cs
Lines 66 to 69 in 043cb5f
If I add this to a MAUI event handler, a span for the HttpClient request is sent correctly as part of the transaction:
Solution
I've used
Hub.StartSpan
instead. This either creates a transaction (if no transaction is set on the scope) or create a child span of the transaction (if a transaction has been set on the scope).