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

Update per recent OT-go PRs #33

Merged
merged 1 commit into from
Jul 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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