feat(core): Allow to pass scope to startSpan APIs#10076
Merged
Conversation
mydea
commented
Jan 5, 2024
|
|
||
| it('forks the scope', () => { | ||
| const initialScope = getCurrentScope(); | ||
| it('creates & finishes span', async () => { |
Member
Author
There was a problem hiding this comment.
just moved these out of the it.each() as they aren't actually using any of it.
mydea
commented
Jan 5, 2024
|
|
||
| /** | ||
| * Get the context related to a scope. | ||
| * TODO v8: Use this for the `trace` functions. |
Member
Author
There was a problem hiding this comment.
These functions still live in opentelemetry which needs to be aligned for v8. It's not worth it to do that now IMHO, just wanted to show that it is possible to implement this in the new model, which it is!
Contributor
size-limit report 📦
|
Lms24
approved these changes
Jan 8, 2024
Also allow to pass this to `withScope()`, which actually aligns with OTEL as well, where you can also do that. If you pass a scope there, it will use this instead of forking a new one.
8329231 to
26d0440
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also allow to pass this to
withScope(), which actually aligns with OTEL as well, where you can also do that. If you pass a scope there, it will use this instead of forking a new one.This should be the last thing needed to refactor some
span.startChild()occurrences - you can now store the scope you want to fork off, and pass this intostartSpanas needed.