-
-
Notifications
You must be signed in to change notification settings - Fork 207
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
Allow defining the "Active Span" #1845
Comments
@bruno-garcia so given adding |
Related to #1679. |
#1679 should be fixed after applying this enhancement to the AspNetCore integration. These two should be done together. |
Some time has passed and I recently took another look at this. We can achieve this goal without modifying the hub. Rather, we just need to implement I propose rather than When used in conjunction with var span = SentrySdk.GetSpan();
Parallel.ForEach(items, item =>
{
SentrySdk.WithScope(scope =>
{
scope.Span = span;
// Do some work that might generate new child spans, etc.
// They'll all be created from the span set on the scope.
});
}); This works well for async also. See my notes and example here: #1679 (comment) |
Fixed in #2364 |
Problem Statement
Integrations such as
SentryHttpMesageHandler
rely onto create a span. This on the Hub today is wired as:
This means I can't set a specific span to get returned from
GetSpan
. When parallelizing work, the parent/child relationship becomes messy since there are multiple spans "active" and relying on the root transaction isn't possible to find out which one it is.Solution Brainstorm
When we're propagating the span explicitly downstream. A user can push a scope and set that new span as the active one. So integrations can find the correct parent span.
For example
_hub.SetActiveSpan(span)
The text was updated successfully, but these errors were encountered: