Skip to content

Commit

Permalink
Make sure onBaggage is called for trimmed Spans
Browse files Browse the repository at this point in the history
and clarify the semantics.
  • Loading branch information
tbg committed Mar 6, 2016
1 parent af45202 commit 9687a12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion span.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func (s *spanImpl) SetBaggageItem(restrictedKey, val string) opentracing.Span {

s.Lock()
defer s.Unlock()
s.onBaggage(canonicalKey, val)
if s.trim() {
return s
}
Expand All @@ -144,7 +145,6 @@ func (s *spanImpl) SetBaggageItem(restrictedKey, val string) opentracing.Span {
s.raw.Baggage = make(map[string]string)
}
s.raw.Baggage[canonicalKey] = val
s.onBaggage(canonicalKey, val)
return s
}

Expand Down
3 changes: 2 additions & 1 deletion tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ type Options struct {
ShouldSample func(int64) bool
// TrimUnsampledSpans turns potentially expensive operations on unsampled
// Spans into no-ops. More precisely, tags, baggage items, and log events
// are silently discarded.
// are silently discarded. If NewSpanEventListener is set, the callbacks
// will still fire in that case.
TrimUnsampledSpans bool
// Recorder receives Spans which have been finished.
Recorder SpanRecorder
Expand Down

0 comments on commit 9687a12

Please sign in to comment.