-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
tracing.opentracing endpoint middleware options #1072
tracing.opentracing endpoint middleware options #1072
Conversation
- optionally trace business errors - add option to set static/dynamic tags - add option to set dynamic name
- some renaming - more flexible tags option: support adding tags with multiple options
- TraceServer and TraceClient should differ only in span kind tag value - remain TraceServer and TraceClient for backward compatibility
Guys, Is it any chance to get it reviewed? |
Hi @alebabai, thanks for the PR and sorry for the late action. I will review tomorrow. |
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.
Great effort. Only a few nits mostly with respect to having more symmetry with the OpenCensus middleware.
tracing/opentracing/endpoint.go
Outdated
// OpenTracing Span called `operationName` with client span.kind tag. | ||
func TraceClient(tracer opentracing.Tracer, operationName string, opts ...EndpointOption) endpoint.Middleware { | ||
opts = append(opts, WithTags(map[string]interface{}{ | ||
ext.SpanKindRPCServer.Key: ext.SpanKindRPCClient.Value, |
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.
ext.SpanKindRPCServer.Key: ext.SpanKindRPCClient.Value, | |
ext.SpanKindRPCClient.Key: ext.SpanKindRPCClient.Value, |
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.
Fixed, thanks
tracing/opentracing/endpoint.go
Outdated
ctx = opentracing.ContextWithSpan(ctx, span) | ||
|
||
response, err := next(ctx, request) | ||
if err := identifyError(response, err, cfg.IgnoreBusinessError); err != nil { |
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.
Would like more symmetry with the OpenCensus implementation and also include the handling of Go kit load balancer retry errors.
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.
it would also be nice that even if an ignore business error is set to true, we would still see it being tagged with "gokit.business.error", again in-line with the OpenCensus implementation.
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.
Yep, you're right.
Implemented it in way as it was done in opencensus, now it support all the stuff.
- support lb.Retry errors - add more logging fields as it done in opencensus - log business error anyway - improve codebase - fix typo - add more test cases
5cab590
to
e5c83b1
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.
@alebabai thank you so much for hanging in there and having the patience to wait for me to finish the review. The code is now finally inline with functionality as found in the other tracers so I'm grateful for the contribution!
what
TraceEndpoint
function to not rely on client/server kinds.tracing.opentracing
endpoint middleware API with some options (like it was done for Opencensus):ext.LogError
function)why
closes #804