@@ -828,7 +828,7 @@ describe('lambda handler', () => {
828
828
} ) ;
829
829
} ) ;
830
830
831
- describe ( 'sqs test ' , ( ) => {
831
+ describe ( 'sync handler sqs propagation ' , ( ) => {
832
832
it ( 'creates process span for sqs record, with lambda invocation span as parent and span link to the producer traceId and spanId' , async ( ) => {
833
833
initializeHandler ( 'lambda-test/sync.sqshandler' ) ;
834
834
const producerTraceId = '1df415edd0ad7f83e573f6504381dcec' ;
@@ -867,4 +867,42 @@ describe('lambda handler', () => {
867
867
assert . equal ( spans [ 0 ] . links [ 0 ] . context . spanId , producerSpanId ) ;
868
868
} ) ;
869
869
} ) ;
870
+
871
+ describe ( 'async handler sqs propagation' , ( ) => {
872
+ it ( 'creates process span for sqs record, with lambda invocation span as parent and span link to the producer traceId and spanId' , async ( ) => {
873
+ initializeHandler ( 'lambda-test/async.sqshandler' ) ;
874
+ const producerTraceId = '1df415edd0ad7f83e573f6504381dcec' ;
875
+ const producerSpanId = '83b7424a259945cb' ;
876
+ const event = {
877
+ Records : [
878
+ {
879
+ messageAttributes : {
880
+ traceparent : {
881
+ stringValue : `00-${ producerTraceId } -${ producerSpanId } -01` ,
882
+ dataType : 'String' ,
883
+ } ,
884
+ } ,
885
+ eventSource : 'aws:sqs' ,
886
+ eventSourceARN :
887
+ 'arn:aws:sqs:eu-central-1:783764587482:launch-queue' ,
888
+ } ,
889
+ ] ,
890
+ } ;
891
+
892
+ await lambdaRequire ( 'lambda-test/async' ) . sqshandler ( event , ctx ) ;
893
+ const spans = memoryExporter . getFinishedSpans ( ) ;
894
+
895
+ assert . strictEqual ( spans . length , 2 ) ;
896
+ assert . equal (
897
+ spans [ 0 ] . parentSpanContext ?. traceId ,
898
+ spans [ 1 ] . spanContext ( ) . traceId
899
+ ) ;
900
+ assert . equal (
901
+ spans [ 0 ] . parentSpanContext ?. spanId ,
902
+ spans [ 1 ] . spanContext ( ) . spanId
903
+ ) ;
904
+ assert . equal ( spans [ 0 ] . links [ 0 ] ?. context . traceId , producerTraceId ) ;
905
+ assert . equal ( spans [ 0 ] . links [ 0 ] . context . spanId , producerSpanId ) ;
906
+ } ) ;
907
+ } ) ;
870
908
} ) ;
0 commit comments