-
Notifications
You must be signed in to change notification settings - Fork 255
OpenTelemetry: Specify span kind and don't set error type for benign exception #2048
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
base: master
Are you sure you want to change the base?
Conversation
|
||
func (t *tracerSpan) Finish(opts *interceptor.TracerFinishSpanOptions) { | ||
if opts.Error != nil { | ||
if opts.Error != nil && !isBenignApplicationError(opts.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.
Open tracing is deprecated, not sure we should bother fixing it here/ do a release to publish this
// from the header or write to the header, where outbound means the span should | ||
// be placed on the Temporal header, and inbound means the parent span can be | ||
// retrieved from the Temporal header. | ||
Outbound bool |
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.
Note: A change like this would break compatibility between new SDK and old tracing modules since they are versioned independently
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.
This is also part of the SDK public API so technically our backwards compatibility guarantees apply.
} | ||
} | ||
|
||
spanKind := trace.SpanKindServer |
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.
Does this line up roughly with what other SDKs like dotnet or python do?
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 so (though I think I just spotted a bug in Python for outbound signal child workflow)
} | ||
} | ||
|
||
spanKind := trace.SpanKindServer |
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 so (though I think I just spotted a bug in Python for outbound signal child workflow)
|
||
func (t *tracerSpan) Finish(opts *interceptor.TracerFinishSpanOptions) { | ||
if opts.Error != nil { | ||
if opts.Error != nil && !isBenignApplicationError(opts.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.
I think our implementation may not have been doing the right thing here because we are not calling .RecordError
, which I think we should always do on error regardless of whether benign (but status as error only for benign like you have here). I don't know if we consider now starting to record errors as a breaking/dangerous change, but probably not.
func isBenignApplicationError(err error) bool { | ||
var appErr *temporal.ApplicationError | ||
if temporal.IsApplicationError(err) { | ||
if errors.As(err, &appErr) { |
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.
Per #1925 (comment), we should only look at the top-level error to determine whether benign. Mimic the isBenignApplicationError
already in internal/error.go
.
What was changed
server
for inbound, andclient
for outboundToHeader
andFromHeader
, they appear to directly be associated with if inbound or outboundWhy?
Checklist
Closes Set Span Kinds in Otel tracer interceptors #2024 and [Feature Request] Reclassify Benign Application errors in OpenTelemetry #2034
How was this tested:
Added tests