Skip to content

Commit

Permalink
Merge pull request #11 from opentracing/name
Browse files Browse the repository at this point in the history
Fix naming of DelegatorCarrier format
  • Loading branch information
tbg committed Mar 6, 2016
2 parents 562a065 + 9687a12 commit c607206
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 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
13 changes: 7 additions & 6 deletions 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 Expand Up @@ -188,10 +189,10 @@ func (t *tracerImpl) startSpanInternal(
return sp
}

type accessorType struct{}
type delegatorType struct{}

// Accessor is the format to use for AccessorCarrier.
var Accessor accessorType
// Delegator is the format to use for DelegatingCarrier.
var Delegator delegatorType

func (t *tracerImpl) Inject(sp opentracing.Span, format interface{}, carrier interface{}) error {
switch format {
Expand All @@ -202,7 +203,7 @@ func (t *tracerImpl) Inject(sp opentracing.Span, format interface{}, carrier int
case opentracing.GoHTTPHeader:
return t.goHTTPPropagator.Inject(sp, carrier)
}
if _, ok := format.(accessorType); ok {
if _, ok := format.(delegatorType); ok {
return t.accessorPropagator.Inject(sp, carrier)
}
return opentracing.ErrUnsupportedFormat
Expand All @@ -217,7 +218,7 @@ func (t *tracerImpl) Join(operationName string, format interface{}, carrier inte
case opentracing.GoHTTPHeader:
return t.goHTTPPropagator.Join(operationName, carrier)
}
if _, ok := format.(accessorType); ok {
if _, ok := format.(delegatorType); ok {
return t.accessorPropagator.Join(operationName, carrier)
}
return nil, opentracing.ErrUnsupportedFormat
Expand Down

0 comments on commit c607206

Please sign in to comment.