-
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
refactor: new interface for ExportResult #1569 #1643
Conversation
c1d28f8
to
ccdc74e
Compare
Codecov Report
@@ Coverage Diff @@
## master #1643 +/- ##
==========================================
+ Coverage 91.19% 91.31% +0.11%
==========================================
Files 165 165
Lines 5066 5066
Branches 1037 1044 +7
==========================================
+ Hits 4620 4626 +6
+ Misses 446 440 -6
|
ccdc74e
to
be5e4cf
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.
LGTM. One quick note about returning an error matching the go impl: in go this is the only way to report an error as there is no throw/try/catch
. I'm still fine with it though.
@@ -72,7 +72,7 @@ export function sendWithXhr( | |||
onSuccess(); | |||
} else { | |||
const error = new collectorTypes.CollectorExporterError( | |||
xhr.responseText, | |||
`Failed to export with XHR (status: ${xhr.status})`, |
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.
What is the reason for this change?
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.
Depending on what the collector report (which itself depend on upstream exporters) you can have a empty text. I prefered to opt for this generic text so user get an error message every time.
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.
xhr.status
already is passed to CollectorExporterError
. Maybe it is better to have xhr.responseText || "Failed to export with XHR"
?
I agree that it would be better if we could only use |
I agree. I was just mentioning it for completeness and for others who might question it. |
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.
one minor thing, other that that lgtm.
Should this have a breaking label ?
|
||
collectorExporter.export(metrics, result => { | ||
assert.deepStrictEqual(result.code, ExportResultCode.FAILED); | ||
assert.ok(result.error?.message.includes('cannot send')); |
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.
the message is still sendBeacon - cannot send
so why shorter check then ?
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 just rewrote the code without thinking about what was in place, i will add it back
|
||
collectorTraceExporter.export(spans, result => { | ||
assert.deepStrictEqual(result.code, ExportResultCode.FAILED); | ||
assert.ok(result.error?.message.includes('cannot send')); |
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.
here the same sendBeacon - cannot send
?
Yeah i believe, specially for vendor exporters. |
There is 2 goals for this PR:
FAILED_RETRYABLE
result since it has been removed from the spec and we expect exporter to handle this.error
inside the result so the error is correctly handled at one place (on theController
for metrics andSpanProcessor
for spans). Previously every exporter had to use theglobalErrorHandler
to report the error which made multiple errors appears (one from the exporter and one for the upstream component that called it)The design is the same as the Golang implementation: https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#go-spanexporter-interface
Fixes #1569