@@ -363,8 +363,7 @@ describe('startSpan', () => {
363363 const normalizedTransactionEvents = transactionEvents . map ( event => {
364364 return {
365365 ...event ,
366- // eslint-disable-next-line deprecation/deprecation
367- spans : event . spans ?. map ( span => ( { name : span . name , id : span . spanContext ( ) . spanId } ) ) ,
366+ spans : event . spans ?. map ( span => ( { name : spanToJSON ( span ) . description , id : span . spanContext ( ) . spanId } ) ) ,
368367 sdkProcessingMetadata : {
369368 dynamicSamplingContext : event . sdkProcessingMetadata ?. dynamicSamplingContext ,
370369 } ,
@@ -387,65 +386,57 @@ describe('startSpan', () => {
387386 // inner span ID should _not_ be the parent span ID, but the id of the new span
388387 expect ( innerSpanId ) . not . toEqual ( innerParentSpanId ) ;
389388
390- expect ( outerTransaction ) . toEqual (
391- expect . objectContaining ( {
392- contexts : {
393- trace : {
394- data : {
395- 'sentry.source' : 'custom' ,
396- 'sentry.sample_rate' : 1 ,
397- 'sentry.origin' : 'manual' ,
398- } ,
399- span_id : expect . any ( String ) ,
400- trace_id : expect . any ( String ) ,
401- origin : 'manual' ,
402- } ,
403- } ,
404- spans : [ { name : 'inner span' , id : expect . any ( String ) } ] ,
405- tags : {
406- transaction : 'outer transaction' ,
407- } ,
408- sdkProcessingMetadata : {
409- dynamicSamplingContext : {
410- environment : 'production' ,
411- trace_id : outerTraceId ,
412- sample_rate : '1' ,
413- transaction : 'outer transaction' ,
414- sampled : 'true' ,
415- } ,
389+ expect ( outerTransaction ?. contexts ) . toEqual ( {
390+ trace : {
391+ data : {
392+ 'sentry.source' : 'custom' ,
393+ 'sentry.sample_rate' : 1 ,
394+ 'sentry.origin' : 'manual' ,
416395 } ,
417- } ) ,
418- ) ;
396+ span_id : expect . any ( String ) ,
397+ trace_id : expect . any ( String ) ,
398+ origin : 'manual' ,
399+ } ,
400+ } ) ;
401+ expect ( outerTransaction ?. spans ) . toEqual ( [ { name : 'inner span' , id : expect . any ( String ) } ] ) ;
402+ expect ( outerTransaction ?. tags ) . toEqual ( {
403+ transaction : 'outer transaction' ,
404+ } ) ;
405+ expect ( outerTransaction ?. sdkProcessingMetadata ) . toEqual ( {
406+ dynamicSamplingContext : {
407+ environment : 'production' ,
408+ trace_id : outerTraceId ,
409+ sample_rate : '1' ,
410+ transaction : 'outer transaction' ,
411+ sampled : 'true' ,
412+ } ,
413+ } ) ;
419414
420- expect ( innerTransaction ) . toEqual (
421- expect . objectContaining ( {
422- contexts : {
423- trace : {
424- data : {
425- 'sentry.source' : 'custom' ,
426- 'sentry.origin' : 'manual' ,
427- } ,
428- parent_span_id : innerParentSpanId ,
429- span_id : expect . any ( String ) ,
430- trace_id : outerTraceId ,
431- origin : 'manual' ,
432- } ,
433- } ,
434- spans : [ { name : 'inner span 2' , id : expect . any ( String ) } ] ,
435- tags : {
436- transaction : 'inner transaction' ,
437- } ,
438- sdkProcessingMetadata : {
439- dynamicSamplingContext : {
440- environment : 'production' ,
441- trace_id : outerTraceId ,
442- sample_rate : '1' ,
443- transaction : 'outer transaction' ,
444- sampled : 'true' ,
445- } ,
415+ expect ( innerTransaction ?. contexts ) . toEqual ( {
416+ trace : {
417+ data : {
418+ 'sentry.source' : 'custom' ,
419+ 'sentry.origin' : 'manual' ,
446420 } ,
447- } ) ,
448- ) ;
421+ parent_span_id : innerParentSpanId ,
422+ span_id : expect . any ( String ) ,
423+ trace_id : outerTraceId ,
424+ origin : 'manual' ,
425+ } ,
426+ } ) ;
427+ expect ( innerTransaction ?. spans ) . toEqual ( [ { name : 'inner span 2' , id : expect . any ( String ) } ] ) ;
428+ expect ( innerTransaction ?. tags ) . toEqual ( {
429+ transaction : 'inner transaction' ,
430+ } ) ;
431+ expect ( innerTransaction ?. sdkProcessingMetadata ) . toEqual ( {
432+ dynamicSamplingContext : {
433+ environment : 'production' ,
434+ trace_id : outerTraceId ,
435+ sample_rate : '1' ,
436+ transaction : 'outer transaction' ,
437+ sampled : 'true' ,
438+ } ,
439+ } ) ;
449440 } ) ;
450441
451442 it ( "picks up the trace id off the parent scope's propagation context" , ( ) => {
@@ -657,8 +648,7 @@ describe('startSpanManual', () => {
657648 const normalizedTransactionEvents = transactionEvents . map ( event => {
658649 return {
659650 ...event ,
660- // eslint-disable-next-line deprecation/deprecation
661- spans : event . spans ?. map ( span => ( { name : span . name , id : span . spanContext ( ) . spanId } ) ) ,
651+ spans : event . spans ?. map ( span => ( { name : spanToJSON ( span ) . description , id : span . spanContext ( ) . spanId } ) ) ,
662652 sdkProcessingMetadata : {
663653 dynamicSamplingContext : event . sdkProcessingMetadata ?. dynamicSamplingContext ,
664654 } ,
@@ -681,65 +671,57 @@ describe('startSpanManual', () => {
681671 // inner span ID should _not_ be the parent span ID, but the id of the new span
682672 expect ( innerSpanId ) . not . toEqual ( innerParentSpanId ) ;
683673
684- expect ( outerTransaction ) . toEqual (
685- expect . objectContaining ( {
686- contexts : {
687- trace : {
688- data : {
689- 'sentry.source' : 'custom' ,
690- 'sentry.sample_rate' : 1 ,
691- 'sentry.origin' : 'manual' ,
692- } ,
693- span_id : expect . any ( String ) ,
694- trace_id : expect . any ( String ) ,
695- origin : 'manual' ,
696- } ,
697- } ,
698- spans : [ { name : 'inner span' , id : expect . any ( String ) } ] ,
699- tags : {
700- transaction : 'outer transaction' ,
701- } ,
702- sdkProcessingMetadata : {
703- dynamicSamplingContext : {
704- environment : 'production' ,
705- trace_id : outerTraceId ,
706- sample_rate : '1' ,
707- transaction : 'outer transaction' ,
708- sampled : 'true' ,
709- } ,
674+ expect ( outerTransaction ?. contexts ) . toEqual ( {
675+ trace : {
676+ data : {
677+ 'sentry.source' : 'custom' ,
678+ 'sentry.sample_rate' : 1 ,
679+ 'sentry.origin' : 'manual' ,
710680 } ,
711- } ) ,
712- ) ;
681+ span_id : expect . any ( String ) ,
682+ trace_id : expect . any ( String ) ,
683+ origin : 'manual' ,
684+ } ,
685+ } ) ;
686+ expect ( outerTransaction ?. spans ) . toEqual ( [ { name : 'inner span' , id : expect . any ( String ) } ] ) ;
687+ expect ( outerTransaction ?. tags ) . toEqual ( {
688+ transaction : 'outer transaction' ,
689+ } ) ;
690+ expect ( outerTransaction ?. sdkProcessingMetadata ) . toEqual ( {
691+ dynamicSamplingContext : {
692+ environment : 'production' ,
693+ trace_id : outerTraceId ,
694+ sample_rate : '1' ,
695+ transaction : 'outer transaction' ,
696+ sampled : 'true' ,
697+ } ,
698+ } ) ;
713699
714- expect ( innerTransaction ) . toEqual (
715- expect . objectContaining ( {
716- contexts : {
717- trace : {
718- data : {
719- 'sentry.source' : 'custom' ,
720- 'sentry.origin' : 'manual' ,
721- } ,
722- parent_span_id : innerParentSpanId ,
723- span_id : expect . any ( String ) ,
724- trace_id : outerTraceId ,
725- origin : 'manual' ,
726- } ,
727- } ,
728- spans : [ { name : 'inner span 2' , id : expect . any ( String ) } ] ,
729- tags : {
730- transaction : 'inner transaction' ,
731- } ,
732- sdkProcessingMetadata : {
733- dynamicSamplingContext : {
734- environment : 'production' ,
735- trace_id : outerTraceId ,
736- sample_rate : '1' ,
737- transaction : 'outer transaction' ,
738- sampled : 'true' ,
739- } ,
700+ expect ( innerTransaction ?. contexts ) . toEqual ( {
701+ trace : {
702+ data : {
703+ 'sentry.source' : 'custom' ,
704+ 'sentry.origin' : 'manual' ,
740705 } ,
741- } ) ,
742- ) ;
706+ parent_span_id : innerParentSpanId ,
707+ span_id : expect . any ( String ) ,
708+ trace_id : outerTraceId ,
709+ origin : 'manual' ,
710+ } ,
711+ } ) ;
712+ expect ( innerTransaction ?. spans ) . toEqual ( [ { name : 'inner span 2' , id : expect . any ( String ) } ] ) ;
713+ expect ( innerTransaction ?. tags ) . toEqual ( {
714+ transaction : 'inner transaction' ,
715+ } ) ;
716+ expect ( innerTransaction ?. sdkProcessingMetadata ) . toEqual ( {
717+ dynamicSamplingContext : {
718+ environment : 'production' ,
719+ trace_id : outerTraceId ,
720+ sample_rate : '1' ,
721+ transaction : 'outer transaction' ,
722+ sampled : 'true' ,
723+ } ,
724+ } ) ;
743725 } ) ;
744726
745727 it ( 'allows to pass a `startTime`' , ( ) => {
@@ -879,8 +861,7 @@ describe('startInactiveSpan', () => {
879861 const normalizedTransactionEvents = transactionEvents . map ( event => {
880862 return {
881863 ...event ,
882- // eslint-disable-next-line deprecation/deprecation
883- spans : event . spans ?. map ( span => ( { name : span . name , id : span . spanContext ( ) . spanId } ) ) ,
864+ spans : event . spans ?. map ( span => ( { name : spanToJSON ( span ) . description , id : span . spanContext ( ) . spanId } ) ) ,
884865 sdkProcessingMetadata : {
885866 dynamicSamplingContext : event . sdkProcessingMetadata ?. dynamicSamplingContext ,
886867 } ,
@@ -903,65 +884,57 @@ describe('startInactiveSpan', () => {
903884 // inner span ID should _not_ be the parent span ID, but the id of the new span
904885 expect ( innerSpanId ) . not . toEqual ( innerParentSpanId ) ;
905886
906- expect ( outerTransaction ) . toEqual (
907- expect . objectContaining ( {
908- contexts : {
909- trace : {
910- data : {
911- 'sentry.source' : 'custom' ,
912- 'sentry.sample_rate' : 1 ,
913- 'sentry.origin' : 'manual' ,
914- } ,
915- span_id : expect . any ( String ) ,
916- trace_id : expect . any ( String ) ,
917- origin : 'manual' ,
918- } ,
919- } ,
920- spans : [ { name : 'inner span' , id : expect . any ( String ) } ] ,
921- tags : {
922- transaction : 'outer transaction' ,
923- } ,
924- sdkProcessingMetadata : {
925- dynamicSamplingContext : {
926- environment : 'production' ,
927- trace_id : outerTraceId ,
928- sample_rate : '1' ,
929- transaction : 'outer transaction' ,
930- sampled : 'true' ,
931- } ,
887+ expect ( outerTransaction ?. contexts ) . toEqual ( {
888+ trace : {
889+ data : {
890+ 'sentry.source' : 'custom' ,
891+ 'sentry.sample_rate' : 1 ,
892+ 'sentry.origin' : 'manual' ,
932893 } ,
933- } ) ,
934- ) ;
894+ span_id : expect . any ( String ) ,
895+ trace_id : expect . any ( String ) ,
896+ origin : 'manual' ,
897+ } ,
898+ } ) ;
899+ expect ( outerTransaction ?. spans ) . toEqual ( [ { name : 'inner span' , id : expect . any ( String ) } ] ) ;
900+ expect ( outerTransaction ?. tags ) . toEqual ( {
901+ transaction : 'outer transaction' ,
902+ } ) ;
903+ expect ( outerTransaction ?. sdkProcessingMetadata ) . toEqual ( {
904+ dynamicSamplingContext : {
905+ environment : 'production' ,
906+ trace_id : outerTraceId ,
907+ sample_rate : '1' ,
908+ transaction : 'outer transaction' ,
909+ sampled : 'true' ,
910+ } ,
911+ } ) ;
935912
936- expect ( innerTransaction ) . toEqual (
937- expect . objectContaining ( {
938- contexts : {
939- trace : {
940- data : {
941- 'sentry.source' : 'custom' ,
942- 'sentry.origin' : 'manual' ,
943- } ,
944- parent_span_id : innerParentSpanId ,
945- span_id : expect . any ( String ) ,
946- trace_id : outerTraceId ,
947- origin : 'manual' ,
948- } ,
949- } ,
950- spans : [ ] ,
951- tags : {
952- transaction : 'inner transaction' ,
953- } ,
954- sdkProcessingMetadata : {
955- dynamicSamplingContext : {
956- environment : 'production' ,
957- trace_id : outerTraceId ,
958- sample_rate : '1' ,
959- transaction : 'outer transaction' ,
960- sampled : 'true' ,
961- } ,
913+ expect ( innerTransaction ?. contexts ) . toEqual ( {
914+ trace : {
915+ data : {
916+ 'sentry.source' : 'custom' ,
917+ 'sentry.origin' : 'manual' ,
962918 } ,
963- } ) ,
964- ) ;
919+ parent_span_id : innerParentSpanId ,
920+ span_id : expect . any ( String ) ,
921+ trace_id : outerTraceId ,
922+ origin : 'manual' ,
923+ } ,
924+ } ) ;
925+ expect ( innerTransaction ?. spans ) . toEqual ( [ ] ) ;
926+ expect ( innerTransaction ?. tags ) . toEqual ( {
927+ transaction : 'inner transaction' ,
928+ } ) ;
929+ expect ( innerTransaction ?. sdkProcessingMetadata ) . toEqual ( {
930+ dynamicSamplingContext : {
931+ environment : 'production' ,
932+ trace_id : outerTraceId ,
933+ sample_rate : '1' ,
934+ transaction : 'outer transaction' ,
935+ sampled : 'true' ,
936+ } ,
937+ } ) ;
965938 } ) ;
966939
967940 it ( 'allows to pass a `startTime`' , ( ) => {
0 commit comments