File tree 2 files changed +2
-6
lines changed
2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,7 @@ function patchModuleRoot (express, tracer) {
29
29
function middleware ( req , res , next ) {
30
30
// start
31
31
const url = `${ req . protocol } ://${ req . hostname } ${ req . originalUrl } `
32
- const parentSpanContextStr = req . headers [ 'trace-span-context' ]
33
- const parentSpanContext = parentSpanContextStr
34
- ? SpanContext . fromString ( parentSpanContextStr )
35
- : undefined
36
-
32
+ const parentSpanContext = tracer . extract ( opentracing . FORMAT_HTTP_HEADERS , req . headers )
37
33
const span = cls . startRootSpan ( tracer , OPERATION_NAME , parentSpanContext )
38
34
39
35
span . setTag ( opentracing . Tags . HTTP_URL , url )
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ function patchHttp (http, tracer) {
54
54
options = _ . isString ( options ) ? url . parse ( options ) : _ . merge ( { } , options )
55
55
options . headers = options . headers || { }
56
56
57
- options . headers [ 'trace- span-context' ] = span . context ( ) . toString ( )
57
+ tracer . inject ( span , opentracing . FORMAT_HTTP_HEADERS , options . headers )
58
58
59
59
const uri = extractUrl ( options )
60
60
span . setTag ( opentracing . Tags . HTTP_URL , uri )
You can’t perform that action at this time.
0 commit comments