Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
Update per recent OT-go PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
bhs committed Jul 26, 2016
1 parent 8d298b3 commit 5c66d39
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func benchmarkInject(b *testing.B, format opentracing.BuiltinFormat, numItems in
var carrier interface{}
switch format {
case opentracing.TextMap:
carrier = opentracing.HTTPHeaderTextMapCarrier(http.Header{})
carrier = opentracing.HTTPHeadersCarrier(http.Header{})
case opentracing.Binary:
carrier = &bytes.Buffer{}
default:
Expand All @@ -123,7 +123,7 @@ func benchmarkExtract(b *testing.B, format opentracing.BuiltinFormat, numItems i
var carrier interface{}
switch format {
case opentracing.TextMap:
carrier = opentracing.HTTPHeaderTextMapCarrier(http.Header{})
carrier = opentracing.HTTPHeadersCarrier(http.Header{})
case opentracing.Binary:
carrier = &bytes.Buffer{}
default:
Expand Down
4 changes: 2 additions & 2 deletions examples/dapperish.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func client() {

httpClient := &http.Client{}
httpReq, _ := http.NewRequest("POST", "http://localhost:8080/", bytes.NewReader([]byte(text)))
textCarrier := opentracing.HTTPHeaderTextMapCarrier(httpReq.Header)
textCarrier := opentracing.HTTPHeadersCarrier(httpReq.Header)
err := span.Tracer().Inject(span.Context(), opentracing.TextMap, textCarrier)
if err != nil {
panic(err)
Expand All @@ -56,7 +56,7 @@ func client() {

func server() {
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
textCarrier := opentracing.HTTPHeaderTextMapCarrier(req.Header)
textCarrier := opentracing.HTTPHeadersCarrier(req.Header)
wireSpanContext, err := opentracing.GlobalTracer().Extract(
opentracing.TextMap, textCarrier)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion propagation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ func TestSpanPropagator(t *testing.T) {
sp := tracer.StartSpan(op)
sp.Context().SetBaggageItem("foo", "bar")

tmc := opentracing.HTTPHeaderTextMapCarrier(http.Header{})
tmc := opentracing.HTTPHeadersCarrier(http.Header{})
tests := []struct {
typ, carrier interface{}
}{
{basictracer.Delegator, basictracer.DelegatingCarrier(&verbatimCarrier{b: map[string]string{}})},
{opentracing.Binary, &bytes.Buffer{}},
{opentracing.HTTPHeaders, tmc},
{opentracing.TextMap, tmc},
}

Expand Down
6 changes: 3 additions & 3 deletions tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ ReferencesLoop:
case opentracing.ChildOfRef,
opentracing.FollowsFromRef:

refMD := ref.Referee.(*SpanContext)
refMD := ref.ReferencedContext.(*SpanContext)
sp.raw.TraceID = refMD.TraceID
sp.raw.SpanID = randomID()
sp.raw.ParentSpanID = refMD.SpanID
Expand Down Expand Up @@ -226,7 +226,7 @@ var Delegator delegatorType

func (t *tracerImpl) Inject(sc opentracing.SpanContext, format interface{}, carrier interface{}) error {
switch format {
case opentracing.TextMap:
case opentracing.TextMap, opentracing.HTTPHeaders:
return t.textPropagator.Inject(sc, carrier)
case opentracing.Binary:
return t.binaryPropagator.Inject(sc, carrier)
Expand All @@ -239,7 +239,7 @@ func (t *tracerImpl) Inject(sc opentracing.SpanContext, format interface{}, carr

func (t *tracerImpl) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error) {
switch format {
case opentracing.TextMap:
case opentracing.TextMap, opentracing.HTTPHeaders:
return t.textPropagator.Extract(carrier)
case opentracing.Binary:
return t.binaryPropagator.Extract(carrier)
Expand Down

0 comments on commit 5c66d39

Please sign in to comment.