fix(opentelemetry): Do not stomp span status when startSpan callback throws#11170
Merged
fix(opentelemetry): Do not stomp span status when startSpan callback throws#11170
startSpan callback throws#11170Conversation
added 2 commits
March 18, 2024 16:13
lforst
commented
Mar 18, 2024
Comment on lines
+89
to
+91
| // Note: Because of this, we currently have a circular type dependency (which we opted out of in package.json). | ||
| // This is not avoidable as we need `spanToJSON` in `spanUtils.ts`, which in turn is needed by `span.ts` for backwards compatibility. | ||
| // And `spanToJSON` needs the Span class from `span.ts` to check here. |
Contributor
Author
There was a problem hiding this comment.
I stumbled onto this but found that this comment had no place in JSDoc.
Member
There was a problem hiding this comment.
Note that all fields returned here are optional and need to be guarded against.
I'd argue this might still be a helpful message but the types should hint that anyway.
Also just to double-check: Putting a line comment between the JSDoc block and the function declaration doesn't prevent the JSDoc from being associated with the function, right?
Contributor
Author
There was a problem hiding this comment.
Yep the JSdoc still works!
Contributor
size-limit report 📦
|
Lms24
approved these changes
Mar 19, 2024
Contributor
Author
|
I will not merge this yet. I'd like to add tests but I had trouble writing some that verified the behaviour I want here... |
Contributor
Author
|
Mergin to unblock #11016 This is implicitly covered by Next.js tests |
cadesalaberry
pushed a commit
to cadesalaberry/sentry-javascript
that referenced
this pull request
Apr 19, 2024
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.
This PR fixes span status stomping in the Otel
starSpanandstartSpanManualimplementations.When the callbacks threw, we didn't check whether there was already a more useful status on there and just stomped it with an
ERRORstatus. Now we only set the status toERRORwhen it wasn't defined already.