@@ -619,31 +619,38 @@ def test_step_function_trace_data(self):
619619 lambda_ctx = get_mock_context ()
620620 sfn_event = {
621621 "Execution" : {
622- "Id" : "665c417c-1237-4742-aaca-8b3becbb9e75" ,
622+ "Id" : "arn:aws:states:sa-east-1:425362996713:execution:abhinav-activity-state-machine:72a7ca3e-901c-41bb-b5a3-5f279b92a316" ,
623+ "Name" : "72a7ca3e-901c-41bb-b5a3-5f279b92a316" ,
624+ "RoleArn" : "arn:aws:iam::425362996713:role/service-role/StepFunctions-abhinav-activity-state-machine-role-22jpbgl6j" ,
625+ "StartTime" : "2024-12-04T19:38:04.069Z" ,
623626 "RedriveCount" : 0 ,
624627 },
625- "StateMachine" : {},
626628 "State" : {
627- "Name" : "my-awesome-state" ,
628- "EnteredTime" : "Mon Nov 13 12:43:33 PST 2023" ,
629+ "Name" : "Lambda Invoke" ,
630+ "EnteredTime" : "2024-12-04T19:38:04.118Z" ,
631+ "RetryCount" : 0 ,
632+ },
633+ "StateMachine" : {
634+ "Id" : "arn:aws:states:sa-east-1:425362996713:stateMachine:abhinav-activity-state-machine" ,
635+ "Name" : "abhinav-activity-state-machine" ,
629636 },
630637 }
631638 ctx , source , event_source = extract_dd_trace_context (sfn_event , lambda_ctx )
632639 self .assertEqual (source , "event" )
633640 expected_context = Context (
634- trace_id = 3675572987363469717 ,
635- span_id = 6880978411788117524 ,
641+ trace_id = 435175499815315247 ,
642+ span_id = 3929055471293792800 ,
636643 sampling_priority = 1 ,
637- meta = {"_dd.p.tid" : "e987c84b36b11ab " },
644+ meta = {"_dd.p.tid" : "3e7a89d1b7310603 " },
638645 )
639646 self .assertEqual (ctx , expected_context )
640647 self .assertEqual (
641648 get_dd_trace_context (),
642649 {
643- TraceHeader .TRACE_ID : "3675572987363469717 " ,
650+ TraceHeader .TRACE_ID : "435175499815315247 " ,
644651 TraceHeader .PARENT_ID : "10713633173203262661" ,
645652 TraceHeader .SAMPLING_PRIORITY : "1" ,
646- TraceHeader .TAGS : "_dd.p.tid=e987c84b36b11ab " ,
653+ TraceHeader .TAGS : "_dd.p.tid=3e7a89d1b7310603 " ,
647654 },
648655 )
649656 create_dd_dummy_metadata_subsegment (ctx , XraySubsegment .TRACE_KEY )
@@ -652,36 +659,44 @@ def test_step_function_trace_data(self):
652659 expected_context ,
653660 )
654661
662+ # https://github.com/DataDog/logs-backend/blob/c17618cb552fc369ca40282bae0a65803f82f694/domains/serverless/apps/logs-to-traces-reducer/src/test/resources/test-json-files/stepfunctions/RedriveTest/snapshots/RedriveLambdaSuccessTraceMerging.json#L46
655663 @with_trace_propagation_style ("datadog" )
656664 def test_step_function_trace_data_redrive (self ):
657665 lambda_ctx = get_mock_context ()
658666 sfn_event = {
659667 "Execution" : {
660- "Id" : "665c417c-1237-4742-aaca-8b3becbb9e75" ,
668+ "Id" : "arn:aws:states:sa-east-1:425362996713:execution:abhinav-activity-state-machine:72a7ca3e-901c-41bb-b5a3-5f279b92a316" ,
669+ "Name" : "72a7ca3e-901c-41bb-b5a3-5f279b92a316" ,
670+ "RoleArn" : "arn:aws:iam::425362996713:role/service-role/StepFunctions-abhinav-activity-state-machine-role-22jpbgl6j" ,
671+ "StartTime" : "2024-12-04T19:38:04.069Z" ,
661672 "RedriveCount" : 1 ,
662673 },
663- "StateMachine" : {},
664674 "State" : {
665- "Name" : "my-awesome-state" ,
666- "EnteredTime" : "Mon Nov 13 12:43:33 PST 2023" ,
675+ "Name" : "Lambda Invoke" ,
676+ "EnteredTime" : "2024-12-04T19:38:04.118Z" ,
677+ "RetryCount" : 0 ,
678+ },
679+ "StateMachine" : {
680+ "Id" : "arn:aws:states:sa-east-1:425362996713:stateMachine:abhinav-activity-state-machine" ,
681+ "Name" : "abhinav-activity-state-machine" ,
667682 },
668683 }
669684 ctx , source , event_source = extract_dd_trace_context (sfn_event , lambda_ctx )
670685 self .assertEqual (source , "event" )
671686 expected_context = Context (
672- trace_id = 3675572987363469717 ,
673- span_id = 1201185214297576513 ,
687+ trace_id = 435175499815315247 ,
688+ span_id = 5063839446130725204 ,
674689 sampling_priority = 1 ,
675- meta = {"_dd.p.tid" : "e987c84b36b11ab " },
690+ meta = {"_dd.p.tid" : "3e7a89d1b7310603 " },
676691 )
677692 self .assertEqual (ctx , expected_context )
678693 self .assertEqual (
679694 get_dd_trace_context (),
680695 {
681- TraceHeader .TRACE_ID : "3675572987363469717 " ,
696+ TraceHeader .TRACE_ID : "435175499815315247 " ,
682697 TraceHeader .PARENT_ID : "10713633173203262661" ,
683698 TraceHeader .SAMPLING_PRIORITY : "1" ,
684- TraceHeader .TAGS : "_dd.p.tid=e987c84b36b11ab " ,
699+ TraceHeader .TAGS : "_dd.p.tid=3e7a89d1b7310603 " ,
685700 },
686701 )
687702 create_dd_dummy_metadata_subsegment (ctx , XraySubsegment .TRACE_KEY )
0 commit comments