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.

Allow defining the "Active Span"

See original GitHub issue

Problem Statement

Integrations such as SentryHttpMesageHandler rely on

_hub.GetSpan()?.StartChild

to create a span. This on the Hub today is wired as:

        public ISpan? GetSpan() => Transaction?.GetLastActiveSpan() ?? Transaction;

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)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
KonstantinLukaschenkocommented, Aug 29, 2022

Related to #1679.

0reactions
mattjohnsonpintcommented, May 11, 2023

Fixed in #2364

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add span tags and filter and group your application ...
The Datadog UI uses tags to set span level metadata. Custom tags may be set for auto-instrumentation by grabbing the active span from...
Read more >
Manual Instrumentation
To create Spans, you only need to specify the name of the span. The start and end time of the span is automatically...
Read more >
Get the currently active span from implicit context
Set the currently active span to the implicit context. This is equivalent to getting the implicit context, then inserting the Span to the ......
Read more >
Chapter: Configuring SPAN and RSPAN
SPAN sessions (local or remote) allow you to monitor traffic on one or more ports, or one or more VLANs, and send the...
Read more >
OpenTelemetry Distributed Tracing [complete guide]
To group spans properly, give them short and concise names. The total number of unique span names should be less than 1000.
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