@@ -617,7 +617,7 @@ def test_with_complete_datadog_trace_headers_with_trigger_tags(self):
617
617
@with_trace_propagation_style ("datadog" )
618
618
def test_step_function_trace_data (self ):
619
619
lambda_ctx = get_mock_context ()
620
- sqs_event = {
620
+ sf_event = {
621
621
"Execution" : {
622
622
"Id" : "665c417c-1237-4742-aaca-8b3becbb9e75" ,
623
623
},
@@ -627,7 +627,7 @@ def test_step_function_trace_data(self):
627
627
"EnteredTime" : "Mon Nov 13 12:43:33 PST 2023" ,
628
628
},
629
629
}
630
- ctx , source , event_source = extract_dd_trace_context (sqs_event , lambda_ctx )
630
+ ctx , source , event_source = extract_dd_trace_context (sf_event , lambda_ctx )
631
631
self .assertEqual (source , "event" )
632
632
expected_context = Context (
633
633
trace_id = 3675572987363469717 ,
@@ -642,7 +642,48 @@ def test_step_function_trace_data(self):
642
642
TraceHeader .TRACE_ID : "3675572987363469717" ,
643
643
TraceHeader .PARENT_ID : "10713633173203262661" ,
644
644
TraceHeader .SAMPLING_PRIORITY : "1" ,
645
- "x-datadog-tags" : "_dd.p.tid=e987c84b36b11ab" ,
645
+ TraceHeader .TAGS : "_dd.p.tid=e987c84b36b11ab" ,
646
+ },
647
+ )
648
+ create_dd_dummy_metadata_subsegment (ctx , XraySubsegment .TRACE_KEY )
649
+ self .mock_send_segment .assert_called_with (
650
+ XraySubsegment .TRACE_KEY ,
651
+ expected_context ,
652
+ )
653
+
654
+ @with_trace_propagation_style ("datadog" )
655
+ def test_step_function_trace_data (self ):
656
+ lambda_ctx = get_mock_context ()
657
+ sf_event = {
658
+ "Execution" : {
659
+ "Id" : "665c417c-1237-4742-aaca-8b3becbb9e75" ,
660
+ },
661
+ "StateMachine" : {},
662
+ "State" : {
663
+ "Name" : "my-awesome-state" ,
664
+ "EnteredTime" : "Mon Nov 13 12:43:33 PST 2023" ,
665
+ },
666
+ "_datadog" : {
667
+ "x-datadog-trace-id" : "4061173386180447114" ,
668
+ "x-datadog-tags" : "_dd.p.tid=aac3639aa724716" ,
669
+ },
670
+ }
671
+ ctx , source , event_source = extract_dd_trace_context (sf_event , lambda_ctx )
672
+ self .assertEqual (source , "event" )
673
+ expected_context = Context (
674
+ trace_id = 4061173386180447114 ,
675
+ span_id = 6880978411788117524 ,
676
+ sampling_priority = 1 ,
677
+ meta = {"_dd.p.tid" : "aac3639aa724716" },
678
+ )
679
+ self .assertEqual (ctx , expected_context )
680
+ self .assertEqual (
681
+ get_dd_trace_context (),
682
+ {
683
+ TraceHeader .TRACE_ID : "4061173386180447114" ,
684
+ TraceHeader .PARENT_ID : "10713633173203262661" ,
685
+ TraceHeader .SAMPLING_PRIORITY : "1" ,
686
+ TraceHeader .TAGS : "_dd.p.tid=aac3639aa724716" ,
646
687
},
647
688
)
648
689
create_dd_dummy_metadata_subsegment (ctx , XraySubsegment .TRACE_KEY )
0 commit comments