File tree Expand file tree Collapse file tree 3 files changed +31
-3
lines changed Expand file tree Collapse file tree 3 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ require (
6
6
github.com/gorilla/mux v1.7.3 // indirect
7
7
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492
8
8
github.com/opentracing/opentracing-go v1.1.0
9
- github.com/openzipkin/zipkin-go v0.2.0
9
+ github.com/openzipkin/zipkin-go v0.2.1
10
10
github.com/stretchr/testify v1.3.0
11
11
google.golang.org/grpc v1.22.1 // indirect
12
12
)
Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 h1
33
33
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 /go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis =
34
34
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU =
35
35
github.com/opentracing/opentracing-go v1.1.0 /go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o =
36
- github.com/openzipkin/zipkin-go v0.2.0 h1:33/f6xXB6YlOQ9tgTsXVOkdLCJsHTcZJnMy4DnSd6FU =
37
- github.com/openzipkin/zipkin-go v0.2.0 /go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4 =
36
+ github.com/openzipkin/zipkin-go v0.2.1 h1:noL5/5Uf1HpVl3wNsfkZhIKbSWCVi5jgqkONNx8PXcA =
37
+ github.com/openzipkin/zipkin-go v0.2.1 /go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4 =
38
38
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1 /go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc =
39
39
github.com/pkg/profile v1.2.1 /go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA =
40
40
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
Original file line number Diff line number Diff line change @@ -59,6 +59,21 @@ func (p *textMapPropagator) Inject(
59
59
return b3 .InjectHTTP (req )(model .SpanContext (sc ))
60
60
}
61
61
}
62
+ // fallback to support native opentracing textmap writer
63
+ if carrier , ok := opaqueCarrier .(opentracing.TextMapWriter ); ok {
64
+ m := make (b3.Map )
65
+ switch p .tracer .opts .b3InjectOpt {
66
+ case B3InjectSingle :
67
+ m .Inject (b3 .WithSingleHeaderOnly ())(model .SpanContext (sc ))
68
+ case B3InjectBoth :
69
+ m .Inject (b3 .WithSingleAndMultiHeader ())(model .SpanContext (sc ))
70
+ default :
71
+ m .Inject ()(model .SpanContext (sc ))
72
+ }
73
+ for k , v := range m {
74
+ carrier .Set (k , v )
75
+ }
76
+ }
62
77
63
78
return opentracing .ErrInvalidCarrier
64
79
}
@@ -81,6 +96,19 @@ func (p *textMapPropagator) Extract(
81
96
}
82
97
return SpanContext {}, err
83
98
}
99
+ if carrier , ok := opaqueCarrier .(opentracing.TextMapReader ); ok {
100
+ m := make (b3.Map )
101
+ carrier .ForeachKey (func (key string , val string ) error {
102
+ m [key ] = val
103
+ return nil
104
+ })
105
+ sc , err := m .Extract ()
106
+ if sc != nil {
107
+ return SpanContext (* sc ), err
108
+ }
109
+ return SpanContext {}, err
110
+ }
111
+
84
112
return nil , opentracing .ErrUnsupportedFormat
85
113
}
86
114
You can’t perform that action at this time.
0 commit comments