Skip to content

Commit

Permalink
tracing: fix OpenTracing traces across nodes
Browse files Browse the repository at this point in the history
"Shadow traces" (OpenTracing) were broken at node boundaries because the
server shadow span was not using the remote span context.
I believe this was broken in cockroachdb#56109.

Fixes cockroachdb#62702

Release note (bug fix): OpenTracing traces work correctly again across
nodes. The client and server spans for RPCs are once again part of the
same trace instead of the server being a root span erroneously.
  • Loading branch information
andreimatei committed Mar 28, 2021
1 parent 4f06297 commit e6212b9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/util/tracing/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ func (t *Tracer) startSpanGeneric(
var shadowCtx opentracing.SpanContext
if opts.Parent != nil && opts.Parent.i.ot.shadowSpan != nil {
shadowCtx = opts.Parent.i.ot.shadowSpan.Context()
} else if opts.RemoteParent != nil && opts.RemoteParent.shadowCtx != nil {
shadowCtx = opts.RemoteParent.shadowCtx
}
ot = makeShadowSpan(shadowTr, shadowCtx, opts.RefType, opName, startTime)
// If LogTags are given, pass them as tags to the shadow span.
Expand Down

0 comments on commit e6212b9

Please sign in to comment.