-
Notifications
You must be signed in to change notification settings - Fork 821
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
feat: add global error handler #1514
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1514 +/- ##
==========================================
+ Coverage 92.93% 93.19% +0.25%
==========================================
Files 156 82 -74
Lines 4871 2161 -2710
Branches 988 428 -560
==========================================
- Hits 4527 2014 -2513
+ Misses 344 147 -197
|
f4b0e46
to
2673088
Compare
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 the global error handler should be a part of api, otherwise we will always depend on sdk which I think is not desired. We should decouple sdk from api as much as possible.
@dyladan what do you think about moving this to api ?
I'm fine with wherever we decide to put this, but the global error handler is meant to log errors that come from the SDK. Quoting from #1415:
|
10d8743
to
c9af41c
Compare
I see this one both ways. Where have other SIGs implemented it? |
Surveying Python and Go and it's a 50/50 split. Python has it as part of the SDK: open-telemetry/opentelemetry-python#1080. Go has it as part of the API: https://github.com/open-telemetry/opentelemetry-go/blob/master/api/global/handler.go. |
Asked in gitter https://gitter.im/open-telemetry/maintainers?at=5f68edb9ce5bbc7ffddc7b9c |
As mentioned by @mwear in gitter, the discussion in open-telemetry/opentelemetry-specification#696 seems to point to including this in the SDK. edit: I also agree with this as I see this as more of an SDK configuration topic than a tracing API |
packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts
Outdated
Show resolved
Hide resolved
message: error.message, | ||
}); | ||
globalErrorHandler(error); | ||
onError(error); |
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.
well i believe it's the case here too, globalErrorHandler
should only be called inside the CollectorExporterBase
i think
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.
You're right, thanks again! I made another pass through and cleaned up redundant calls to the globalErrorHandler
.
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 actually forgotten about those path (see #1561):
return new Promise((resolve, reject) => { | |
this._exporter.export( | |
this._meter.getBatcher().checkPointSet(), | |
result => { | |
if (result === ExportResult.SUCCESS) { | |
resolve(); | |
} else { | |
// @todo log error | |
reject(); | |
} | |
} | |
); | |
}); |
@vmarchaud I made the changes you requested. Let me know if that's what you had in mind. Codecov is coming in slim after the latest round of changes though. |
Codecov is having a service outage but the error handler itself is tested so I think this is fine. If you fix the conflicts this can be merged. |
I had to make a few changes for this to work: * Change the Exception enums to allow code to a number or string * Require message in the CollectorExporterError interface
FWIW, I increased the test coverage before rebasing. |
Which problem is this PR solving?
Short description of the changes
ConsoleLogger
atLogLevel.ERROR
. This might be a questionable default and we can discuss alternatives.