Skip to content

Commit

Permalink
Merge pull request #16882 from tschottdorf/child-span
Browse files Browse the repository at this point in the history
tracing: start net/trace span in ChildSpan
  • Loading branch information
tbg authored Jul 6, 2017
2 parents f3e9941 + a64b86b commit b86de26
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions pkg/util/tracing/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,6 @@ func StartChildSpan(
linkShadowSpan(s, pSpan.shadowTr, pSpan.shadowSpan.Context(), opentracing.ChildOfRef)
}

if pSpan.netTr != nil || pSpan.shadowTr != nil {
// Copy baggage items to tags so they show up in the shadow tracer UI or x/net/trace.
for k, v := range s.mu.Baggage {
s.SetTag(k, v)
}
}

// Start recording if necessary.
if pSpan.isRecording() {
recordingGroup := pSpan.mu.recordingGroup
Expand All @@ -351,6 +344,18 @@ func StartChildSpan(
s.enableRecording(recordingGroup, pSpan.mu.recordingType)
}

if pSpan.netTr != nil {
s.netTr = trace.New("tracing", operationName)
s.netTr.SetMaxEvents(maxLogsPerSpan)
}

if pSpan.netTr != nil || pSpan.shadowTr != nil {
// Copy baggage items to tags so they show up in the shadow tracer UI or x/net/trace.
for k, v := range s.mu.Baggage {
s.SetTag(k, v)
}
}

pSpan.mu.Unlock()
return s
}
Expand Down

0 comments on commit b86de26

Please sign in to comment.