File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
src/opentracing/propagation
test/opentracing/propagation Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -339,11 +339,11 @@ class TextMapPropagator {
339
339
context . _links . push ( link )
340
340
}
341
341
}
342
+ }
342
343
343
- if ( this . _config . tracePropagationStyle . extract . includes ( 'baggage' ) && carrier . baggage ) {
344
- context = context || new DatadogSpanContext ( )
345
- this . _extractBaggageItems ( carrier , context )
346
- }
344
+ if ( this . _hasPropagationStyle ( 'extract' , 'baggage' ) && carrier . baggage ) {
345
+ context = context || new DatadogSpanContext ( )
346
+ this . _extractBaggageItems ( carrier , context )
347
347
}
348
348
349
349
return context || this . _extractSqsdContext ( carrier )
Original file line number Diff line number Diff line change @@ -406,7 +406,6 @@ describe('TextMapPropagator', () => {
406
406
} )
407
407
408
408
it ( 'should extract otel baggage items with special characters' , ( ) => {
409
- process . env . DD_TRACE_BAGGAGE_ENABLED = true
410
409
config = new Config ( )
411
410
propagator = new TextMapPropagator ( config )
412
411
const carrier = {
@@ -452,6 +451,20 @@ describe('TextMapPropagator', () => {
452
451
expect ( spanContextD . _baggageItems ) . to . deep . equal ( { } )
453
452
} )
454
453
454
+ it ( 'should extract baggage when it is the only propagation style' , ( ) => {
455
+ config = new Config ( {
456
+ tracePropagationStyle : {
457
+ extract : [ 'baggage' ]
458
+ }
459
+ } )
460
+ propagator = new TextMapPropagator ( config )
461
+ const carrier = {
462
+ baggage : 'foo=bar'
463
+ }
464
+ const spanContext = propagator . extract ( carrier )
465
+ expect ( spanContext . _baggageItems ) . to . deep . equal ( { foo : 'bar' } )
466
+ } )
467
+
455
468
it ( 'should convert signed IDs to unsigned' , ( ) => {
456
469
textMap [ 'x-datadog-trace-id' ] = '-123'
457
470
textMap [ 'x-datadog-parent-id' ] = '-456'
You can’t perform that action at this time.
0 commit comments