-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(span-first): Remove active from startSpan options
#16008
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
base: master
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
| - Spans MUST be started as active by default. This means that any span started, while the initial span is active, MUST be attached as a child span of the active span. | ||
| - Only if users set `active: false`, the span will be started as inactive, meaning spans started while this span is not yet ended, will not become children, but siblings of the started span. | ||
| - Spans MUST be started as active by default. This means that any span started, while the initial span is active, MUST be attached as a child span of the active span. | ||
| - Inactive span behaviour is possible if users pass the parent of the currently active span as `parentSpan` which will attach the started span as a sibling of the currently active span. |
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.
pls double check in case I misunderstood
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.
I think you're correct here in terms of how we discussed it. But I realized that this might not be what we want. See my comment below
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.
Before we merge this I would like to confirm that the replacement is sound.
With this change, we put more work on users:
- previously, they could mark one span as
active: false, and all potential spans started while said span was running, would be attached to the active span (i.e. not the one marked) - now, with the proposed change, every span that might be started while the span that should be inactive is running, must explicitly set another parent. This gets especially tricky if we're talking about auto instrumentation.
I would argue there are good reasons for still starting individual inactive spans without having to care about others.
Pseudocode example
// Assume: fetch calls are instrumented automatically, creating `http.client` spans
const myParentSpan = Sentry.startSpan({name: 'parent'});
fetch('/resource-1').then(...);
fetch('/resource-2').then(...);
myParentSpan.end()If the fetch spans are not started as inactive, we end up with this hierarchy:
- parent
- fetch resource-1
- fetch resource-2
- fetch resource-1
and there's little we can do about that, given fetch calls are auto instrumented.
While if auto instrumentation can start fetch spans with active: false, we get the "correct" hierarchy:
- parent
- fetch resource-1
- fetch resource-2
Fwiw, I think http.client spans are good examples for inactive spans, since there's rarely a reason to attach a child span to them (if ever?). We currently start http.client spans as inactive spans in JS.
|
Android/Java has |
DESCRIBE YOUR PR
Tell us what you're changing and why. If your PR resolves an issue, please link it so it closes automatically.
Removes
activefromstartSpanIS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes:
LEGAL BOILERPLATE
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
EXTRA RESOURCES