@@ -659,6 +659,20 @@ describe('TextMapPropagator', () => {
659
659
}
660
660
} ) )
661
661
} )
662
+
663
+ it ( 'should skip extracting upper bits for 64-bit trace IDs' , ( ) => {
664
+ textMap [ 'b3' ] = '00000000000000000000000000000123-0000000000000456'
665
+
666
+ config . traceId128BitGenerationEnabled = true
667
+
668
+ const carrier = textMap
669
+ const spanContext = propagator . extract ( carrier )
670
+
671
+ expect ( spanContext ) . to . deep . equal ( createContext ( {
672
+ traceId : id ( '00000000000000000000000000000123' , 16 ) ,
673
+ spanId : id ( '456' , 16 )
674
+ } ) )
675
+ } )
662
676
} )
663
677
664
678
describe ( 'With traceparent propagation as single header' , ( ) => {
@@ -704,6 +718,18 @@ describe('TextMapPropagator', () => {
704
718
expect ( spanContext . _trace . tags ) . to . have . property ( '_dd.p.tid' , '1111aaaa2222bbbb' )
705
719
} )
706
720
721
+ it ( 'should skip extracting upper bits for 64-bit trace IDs' , ( ) => {
722
+ textMap [ 'traceparent' ] = '00-00000000000000003333cccc4444dddd-5555eeee6666ffff-01'
723
+ config . tracePropagationStyle . extract = [ 'tracecontext' ]
724
+ config . traceId128BitGenerationEnabled = true
725
+
726
+ const carrier = textMap
727
+ const spanContext = propagator . extract ( carrier )
728
+
729
+ expect ( spanContext . _traceId . toString ( 16 ) ) . to . equal ( '00000000000000003333cccc4444dddd' )
730
+ expect ( spanContext . _trace . tags ) . to . not . have . property ( '_dd.p.tid' )
731
+ } )
732
+
707
733
it ( 'should propagate the version' , ( ) => {
708
734
textMap [ 'traceparent' ] = '01-1111aaaa2222bbbb3333cccc4444dddd-5555eeee6666ffff-01'
709
735
textMap [ 'tracestate' ] = 'other=bleh,dd=t.foo_bar_baz_:abc_!@#$%^&*()_+`-~;s:2;o:foo;t.dm:-4'
0 commit comments