Skip to content

Commit

Permalink
Merge pull request #6 from opentracing/new_inject_join_api
Browse files Browse the repository at this point in the history
Change basictracer-go per opentracing-go's PR#65
  • Loading branch information
bensigelman committed Feb 29, 2016
2 parents 81408a6 + e65e7ca commit 5faedce
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions propagation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type DelegatingCarrier interface {
GetBaggage(func(key, value string))
}

func (p *accessorPropagator) InjectSpan(
func (p *accessorPropagator) Inject(
sp opentracing.Span,
carrier interface{},
) error {
Expand All @@ -40,7 +40,7 @@ func (p *accessorPropagator) InjectSpan(
return nil
}

func (p *accessorPropagator) JoinTrace(
func (p *accessorPropagator) Join(
operationName string,
carrier interface{},
) (opentracing.Span, error) {
Expand Down
16 changes: 8 additions & 8 deletions propagation_ot.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const (
fieldNameSampled = "sampled"
)

func (p *splitTextPropagator) InjectSpan(
func (p *splitTextPropagator) Inject(
sp opentracing.Span,
carrier interface{},
) error {
Expand Down Expand Up @@ -59,7 +59,7 @@ func (p *splitTextPropagator) InjectSpan(
return nil
}

func (p *splitTextPropagator) JoinTrace(
func (p *splitTextPropagator) Join(
operationName string,
carrier interface{},
) (opentracing.Span, error) {
Expand Down Expand Up @@ -120,7 +120,7 @@ func (p *splitTextPropagator) JoinTrace(
), nil
}

func (p *splitBinaryPropagator) InjectSpan(
func (p *splitBinaryPropagator) Inject(
sp opentracing.Span,
carrier interface{},
) error {
Expand Down Expand Up @@ -177,7 +177,7 @@ func (p *splitBinaryPropagator) InjectSpan(
return nil
}

func (p *splitBinaryPropagator) JoinTrace(
func (p *splitBinaryPropagator) Join(
operationName string,
carrier interface{},
) (opentracing.Span, error) {
Expand Down Expand Up @@ -261,13 +261,13 @@ const (
traceBaggageHeaderName = "Trace-Baggage"
)

func (p *goHTTPPropagator) InjectSpan(
func (p *goHTTPPropagator) Inject(
sp opentracing.Span,
carrier interface{},
) error {
// Defer to SplitBinary for the real work.
splitBinaryCarrier := opentracing.NewSplitBinaryCarrier()
if err := p.splitBinaryPropagator.InjectSpan(sp, splitBinaryCarrier); err != nil {
if err := p.splitBinaryPropagator.Inject(sp, splitBinaryCarrier); err != nil {
return err
}

Expand All @@ -281,7 +281,7 @@ func (p *goHTTPPropagator) InjectSpan(
return nil
}

func (p *goHTTPPropagator) JoinTrace(
func (p *goHTTPPropagator) Join(
operationName string,
carrier interface{},
) (opentracing.Span, error) {
Expand Down Expand Up @@ -309,5 +309,5 @@ func (p *goHTTPPropagator) JoinTrace(
TracerState: tracerStateBinary,
Baggage: traceBaggageBinary,
}
return p.splitBinaryPropagator.JoinTrace(operationName, splitBinaryCarrier)
return p.splitBinaryPropagator.Join(operationName, splitBinaryCarrier)
}
24 changes: 12 additions & 12 deletions tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,32 +155,32 @@ type accessorType struct{}
// Accessor is the format to use for AccessorCarrier.
var Accessor accessorType

func (t *tracerImpl) Extractor(format interface{}) opentracing.Extractor {
func (t *tracerImpl) Inject(sp opentracing.Span, format interface{}, carrier interface{}) error {
switch format {
case opentracing.SplitText:
return t.textPropagator
return t.textPropagator.Inject(sp, carrier)
case opentracing.SplitBinary:
return t.binaryPropagator
return t.binaryPropagator.Inject(sp, carrier)
case opentracing.GoHTTPHeader:
return t.goHTTPPropagator
return t.goHTTPPropagator.Inject(sp, carrier)
}
if _, ok := format.(accessorType); ok {
return t.accessorPropagator
return t.accessorPropagator.Inject(sp, carrier)
}
return nil
return opentracing.ErrUnsupportedFormat
}

func (t *tracerImpl) Injector(format interface{}) opentracing.Injector {
func (t *tracerImpl) Join(operationName string, format interface{}, carrier interface{}) (opentracing.Span, error) {
switch format {
case opentracing.SplitText:
return t.textPropagator
return t.textPropagator.Join(operationName, carrier)
case opentracing.SplitBinary:
return t.binaryPropagator
return t.binaryPropagator.Join(operationName, carrier)
case opentracing.GoHTTPHeader:
return t.goHTTPPropagator
return t.goHTTPPropagator.Join(operationName, carrier)
}
if _, ok := format.(accessorType); ok {
return t.accessorPropagator
return t.accessorPropagator.Join(operationName, carrier)
}
return nil
return nil, opentracing.ErrUnsupportedFormat
}

0 comments on commit 5faedce

Please sign in to comment.