Option to link Http Request Spans to the Root Transaction?
See original GitHub issuePackage
Sentry.AspNetCore
.NET Flavor
.NET Core
.NET Version
6.0.0
OS
Windows
SDK Version
3.17.1
Self-Hosted Sentry Version
No response
Steps to Reproduce
Sample project: https://github.com/lucas-zimerman/httpclient-stack-sample
-
run and once you get information on the browser an event will be sent to
Sentry SDKs
org on the .NET project. -
but it should be replicable if you call an httpclient in parallel inside of a request.
Expected Result
Looking at the code, you may expect that each span generated on the ForEach loop would have the parentId as GetAnimals
Actual Result
Due to the defined behavior the HttpClient will try to get the last opened span and due to the parallel behavior, you’ll end up with multiple
GetDog
spans inside of each other.
One idea is to set an option that affects spans not generated by the user where you can define if the parent will be the last opened Span or always the scope Transaction, (or maybe even an user defined logic?).
EDIT: A brainstorm. Spans could have a parameter that would hide it from GetSpan
, let’s name it AllowChildren
. in specific cases like a http request, we could easily assume it’s the last span from a stack so we set AllowChildren
as false on HttpClient spans, with that, when you call GetSpan
you’ll always get the last open span that could have a children.
The same idea could be applied to the DiagnosticSource Spans or even into parallel code from users.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:6 (5 by maintainers)
The important thing is that it got fixed 😄