-
Notifications
You must be signed in to change notification settings - Fork 451
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
Revisit error handling in trace #371
Conversation
It could help propagate error from upstream components.
Export error will consist two parts. The first one is two variant in TraceError. One for timed out, the other for all other errors. The other part is a trait ExportError, which extended the Error trait by asking user to provide the name of the exporter. Users should implement their own Error for their exporters and implement ExportError on those errors. (todo): Add errors for all exporters
Codecov Report
@@ Coverage Diff @@
## master #371 +/- ##
==========================================
- Coverage 54.00% 53.50% -0.51%
==========================================
Files 71 72 +1
Lines 6051 6117 +66
==========================================
+ Hits 3268 3273 +5
- Misses 2783 2844 +61
Continue to review full report at Codecov.
|
25ae3ec
to
9c1952d
Compare
9c1952d
to
eea7237
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.
Nice start, couple of thoughts as the draft progresses
* Fix typo and naming * Use thiserror for stdout exporter and datadog exporter * Implement Error for opentelemetry::Error, renamed from OpenTelemetryError
74e683d
to
487c33d
Compare
…try-rust into error-handling � Conflicts: � opentelemetry-jaeger/Cargo.toml
* Add ExportError in MetricsError. It can help unify the export error among trace, metric and logging in the future. * Merge TraceError::Other into TraceError::Boxed. Those two seems to have a lot in common. Created a custom wrap type for string and metric those two variants. * Remove default implement for exporter_name. It should have used in case like http client failure. But it could also encourage ppl not implement it at all.
6914268
to
01c8265
Compare
* Remove HttpClientError
01c8265
to
fb54263
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.
Looking good! only a couple of small comments, also looks like the msrv tests are now broken by an async std dependency, maybe we could feature flag those tests so they only run if async-std feature is used?
Or maybe just remove async-std from msrv job in
|
ebc902b
to
5aeeb22
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.
small nits left but looking good, ready whenever out of draft state
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.
Looks good!
Current approaches
Currently, most of the errors in
trace
have been returned viaBox<dyn std::error::Error + Send + Sync + 'static>
. This approach gives users good flexibility to return basically any errors. But it totally depends on user to return meaningful messages in errors to help end user to understand the issue.Proposed approaches
As discussed in #286, we decided to use
thiserror
library wide to allow multiple level of errors throughout the whole process to send span.We define a
TraceError
enum to represent any possible errors fromtrace
module. It provides some predefined variantion, and we should add more variantions as needed. It also provides two generic variantionsOther
andBoxed
.Other
could hold any string andBoxed
could hold anyBox<dyn std::error::Error + Send + Sync + 'static>
. It allows the user to adapt their currently implementation easily.We define a
ExporterError
trait, which contains one method to return the name of the exporter. Exporter implementations are engouraged to define their own Error type and implement ExporterError. This allow any exporter implementations to pass their custom errors back to SDK. This should also help narrow down which exporter causes the error when errors being returned.Change function signature to return
TraceError
orExporterError
when possible. And use global error handler to handle the rest of errors