-
Notifications
You must be signed in to change notification settings - Fork 806
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
fix(tracing): use globalErrorHandler when flushing fails #1622
fix(tracing): use globalErrorHandler when flushing fails #1622
Conversation
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 should add it there too https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-tracing/src/export/SimpleSpanProcessor.ts#L65 (for those we don't use the batch processor)
Codecov Report
@@ Coverage Diff @@
## master #1622 +/- ##
=======================================
Coverage 91.21% 91.22%
=======================================
Files 165 165
Lines 5064 5069 +5
Branches 1038 1039 +1
=======================================
+ Hits 4619 4624 +5
Misses 445 445
|
741ab49
to
6364bc6
Compare
@vmarchaud something like this? You link points to the shutdown method, but the change in BatchSpanProcessor only affects the export. I also wrapped the export in the SimpleSpanProcessor or should I also wrap shutdown in both processors? |
6364bc6
to
c52d478
Compare
@johanneswuerbach Yeah sorry i linked to wrong line :/ I'm good with the PR now, even though i would like that we report the actual error that the exporter had but for now this is fine. |
@open-telemetry/javascript-approvers I agree with @johanneswuerbach that this is important to fix and release asap, it's common best practices to exit the process when there is an |
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 we are changing the api of BatchSpanProcessor here which might not cover all user cases. If method returns the promise it should handle both cases resolve and reject. Forcing to use global handler is not necessary something someone might want. Not even mentioning that the result
from export is gone. Using global handler should be something that user might opt to turn on or off instead of dropping "reject" from promise. If someone already build a mechanism to retry again in case result is FAILED_RETRYABLE
the whole logic will be gone. I'm against of changing the "natural" api of Promise
which is returned by this method as then this method will become useless for other cases (for example to build auto retry for FAILED_RETRYABLE
result etc.)
@obecny the problem in this case is that outside of One call site where this method is currently called is: While I'm not sure what the desired future is, there is #1569, which sounds like retry should be implemented at the exporter layer and not here. |
then why not in line 93 do something like this:
and then line 122 should also have the same what line 93. the flush is used also in |
@vmarchaud / @dyladan would that also be okay? We generally see tracing as best-effort so we don't care about errors, but I'm happy to wrap the catch those errors in our apps. |
I don't think @obecny is suggesting you wrap the error in your app, but wrap it in I think the way the PR has it now is fine. The global error handler changed error behavior in a lot of places already and this is just one more.
@obecny note that the spec for span processors does not return the result type https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#interface-definition Also see in the spec https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#exportbatch
The RETRYABLE vs NON_RETRYABLE failure has been removed from the spec completely and should be removed in another PR. |
As a user I would be really surprised why suddenly I don't see a bug from a method I just called that wasn't successful. |
👍 seems reasonable to me. |
Updated the PR, let me know if that looks better :-) |
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.
lgtm, thx for changes
Would it be possible to get this into |
Fixes #1617
Short description of the changes
Use the global error handler #1514 when span flushing fails in the BatchSpanProcessor instead of causing an unhandled rejection.