-
Notifications
You must be signed in to change notification settings - Fork 805
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
Metric ExportResult other than SUCCESS causes UnhandledPromiseRejectionWarning: undefined #1561
Comments
This will be fixed once we merge #1514 |
I'm not sure that will fix it after looking at the PR. Without actually adding a The |
@aabmass Not in the current state i agree but this promise should be catched then sent to the global error handler (which the PR i mentionned implement) |
Hello. Author of #1514 here. I just wanted to check in to see what the best way to solve this issue is. As you point out @aabmass, there isn't really a handle on an error to log in the push controller. It seems like the error handling needs to come a level further up, like in the |
@mwear I'm maintaining the Google Cloud Monitoring exporter. This comes up from here in the exporter. We sometimes want to retry so we call the callback with |
Thanks for the information @aabmass. The reason I ask is that in #1514 the recommendation is to add a
The code path in the PushController rejects the promise based on the result of the The collector exporter uses the globalErrorHandler one level above in the export method, before calling the opentelemetry-js/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts Lines 71 to 89 in 40e24bf
Since your problem is due to the export result passed to the callback and not an unhandled error, I don't think a catch will help in the |
@mwear Isn't it a problem with the spec then ? In the case of a Note: the spec declare that any retry logic should be handled by the exporter so the result |
It looks like the go implementation has what we ultimately want. The export result has both a code and a wrapped error: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#go-spanexporter-interface. I think this is a bit of a refactor and too much for #1514, but something we can consider. |
@mwear for this issue specifically I think adding a I also noticed #987 which could be a part of the refactor you mentioned since the callback api is a little strange 🙂 |
I'm struggling a bit to understand why this issue isn't prioritised. Rolling out While we use Node 14, we already exit on unhandled promise rejections as done by default on Node 15 (nodejs/TSC#916) so an unhandled rejection is causing our processes to exit. Additionally the issue is challenging to pin down as the rejection value is a plain number, so the generated stack traces aren't really valuable. Example trace:
How would a fix here look like? Add We are using the jaeger exporter, which is already logging the error itself https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-exporter-jaeger/src/jaeger.ts#L139-L141 |
@johanneswuerbach Well this should have been fined with #1514, the metric controller doesnt reject anymore: https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-metrics/src/export/Controller.ts#L57. Are you sure you are using the newest metrics sdk version ? |
Sorry, we are hitting this issue in the tracing BatchSpanProcessor https://github.com/open-telemetry/opentelemetry-js/blob/master/packages/opentelemetry-tracing/src/export/BatchSpanProcessor.ts#L110, not in the metrics controller. I somehow mixed this up as the error and code in question looks pretty similar, should I create a new issue? |
@johanneswuerbach Yeah i think a new issue would be the way to go. @aabmass Since the metric exporter doesnt throw anymore, are you okay with closing this issue ? We can totally open one to refactor to include the error inside the error handler as @mwear suggested |
Sorry for the noise, created #1617 for the unhandled rejection issue when exporting traces . |
@vmarchaud #1514 looks like it would have solved my issue 👍 |
I was seeing
UnhandledPromiseRejectionWarning: undefined
warnings when using a metric exporter. Running node with--trace-warnings
gives a little more information but not a real trace unfortunately:Eventually, I found the warning to be coming from exporters giving status of
ExportResult.FAILED_*
(anything other thanSUCCESS
).PushController
justreject()
s the promise here:opentelemetry-js/packages/opentelemetry-metrics/src/export/Controller.ts
Lines 48 to 60 in d8b1be8
This code is running in a
setInterval()
so never gets awaited. The fix is to address the@todo
and log instead ofreject()
.The text was updated successfully, but these errors were encountered: