Skip to content

Commit

Permalink
refactor(tracing.opentracing): use ContextWithSpan after applying tags
Browse files Browse the repository at this point in the history
just cosmetics
  • Loading branch information
alebabai committed Apr 5, 2021
1 parent b8df650 commit 93f53b2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tracing/opentracing/endpoint.go
Expand Up @@ -41,14 +41,15 @@ func TraceEndpoint(tracer opentracing.Tracer, operationName string, opts ...Endp
span = tracer.StartSpan(operationName)
}
defer span.Finish()
ctx = opentracing.ContextWithSpan(ctx, span)

applyTags(span, cfg.Tags)
if cfg.GetTags != nil {
extraTags := cfg.GetTags(ctx)
applyTags(span, extraTags)
}

ctx = opentracing.ContextWithSpan(ctx, span)

response, err := next(ctx, request)
if err := identifyError(response, err, cfg.IgnoreBusinessError); err != nil {
ext.LogError(span, err)
Expand Down

0 comments on commit 93f53b2

Please sign in to comment.