diff --git a/span.go b/span.go index 24f98f2aa429..feac9dd8af55 100644 --- a/span.go +++ b/span.go @@ -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 } @@ -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 } diff --git a/tracer.go b/tracer.go index 2c6fe223b118..eb81773829d5 100644 --- a/tracer.go +++ b/tracer.go @@ -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