@@ -652,7 +652,7 @@ def test_step_function_trace_data(self):
652
652
)
653
653
654
654
@with_trace_propagation_style ("datadog" )
655
- def test_step_function_trace_data_with_header (self ):
655
+ def test_step_function_trace_data_with_trace_header (self ):
656
656
lambda_ctx = get_mock_context ()
657
657
sf_event = {
658
658
"Execution" : {
@@ -692,6 +692,46 @@ def test_step_function_trace_data_with_header(self):
692
692
expected_context ,
693
693
)
694
694
695
+ @with_trace_propagation_style ("datadog" )
696
+ def test_step_function_trace_data_with_arn_header (self ):
697
+ lambda_ctx = get_mock_context ()
698
+ sf_event = {
699
+ "Execution" : {
700
+ "Id" : "665c417c-1237-4742-aaca-8b3becbb9e75" ,
701
+ },
702
+ "StateMachine" : {},
703
+ "State" : {
704
+ "Name" : "my-awesome-state" ,
705
+ "EnteredTime" : "Mon Nov 13 12:43:33 PST 2023" ,
706
+ },
707
+ "_datadog" : {
708
+ "x-datadog-execution-arn" : "ca7383bc-e370-4a85-a266-a4686bd7d00f"
709
+ },
710
+ }
711
+ ctx , source , event_source = extract_dd_trace_context (sf_event , lambda_ctx )
712
+ self .assertEqual (source , "event" )
713
+ expected_context = Context (
714
+ trace_id = 6970872619724504833 ,
715
+ span_id = 6880978411788117524 ,
716
+ sampling_priority = 1 ,
717
+ meta = {"_dd.p.tid" : "71dab8f4d4629263" },
718
+ )
719
+ self .assertEqual (ctx , expected_context )
720
+ self .assertEqual (
721
+ get_dd_trace_context (),
722
+ {
723
+ TraceHeader .TRACE_ID : "6970872619724504833" ,
724
+ TraceHeader .PARENT_ID : "10713633173203262661" ,
725
+ TraceHeader .SAMPLING_PRIORITY : "1" ,
726
+ TraceHeader .TAGS : "_dd.p.tid=71dab8f4d4629263" ,
727
+ },
728
+ )
729
+ create_dd_dummy_metadata_subsegment (ctx , XraySubsegment .TRACE_KEY )
730
+ self .mock_send_segment .assert_called_with (
731
+ XraySubsegment .TRACE_KEY ,
732
+ expected_context ,
733
+ )
734
+
695
735
def test_is_legacy_lambda_step_function (self ):
696
736
sf_event = {
697
737
"Payload" : {
0 commit comments