question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to link Http Request Spans to the Root Transaction?

See original GitHub issue

Package

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 image

Actual Result

https://sentry.io/organizations/sentry-sdks/discover/sentry-dotnet:dc044830d1994a2685d81dd22eb3cb7c/?field=title&field=event.type&field=project&field=user.display&field=timestamp&name=All+Events&query=&sort=-timestamp&statsPeriod=1h&yAxis=count()

image 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:closed
  • Created a year ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mattjohnsonpintcommented, May 11, 2023
image
0reactions
lucas-zimermancommented, May 16, 2023

I’m a bit embarrassed now, as it seems we reached a similar conclusion some time ago with #1845.

The important thing is that it got fixed 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP spans doesn't show the full information about ...
Hi! I'm using Opentelemetry + Elastic. The problem that I'm facing is that the http requests child spans doesn't show the full information....
Read more >
Traces
In OpenTelemetry, they include the following information: Name; Parent span ID (empty for root spans); Start and End Timestamps; Span Context; Attributes; Span...
Read more >
Understand and use the distributed tracing UI
On the trace details page, review the span along the request route that originated the error. Noting the error class and message, navigate...
Read more >
OpenTelemetry Support - Sentry Developer Documentation
In Sentry, we have two options for how to treat span events. First, we can add them as breadcrumbs to the transaction the...
Read more >
Distributed Tracing
Learn more about distributed tracing and how Sentry tracks your software performance, measures throughput and latency, and displays the impact of errors ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found