@@ -617,7 +617,7 @@ def test_with_complete_datadog_trace_headers_with_trigger_tags(self):
617617 @with_trace_propagation_style ("datadog" )
618618 def test_step_function_trace_data (self ):
619619 lambda_ctx = get_mock_context ()
620- sqs_event = {
620+ sf_event = {
621621 "Execution" : {
622622 "Id" : "665c417c-1237-4742-aaca-8b3becbb9e75" ,
623623 },
@@ -627,7 +627,7 @@ def test_step_function_trace_data(self):
627627 "EnteredTime" : "Mon Nov 13 12:43:33 PST 2023" ,
628628 },
629629 }
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 )
631631 self .assertEqual (source , "event" )
632632 expected_context = Context (
633633 trace_id = 3675572987363469717 ,
@@ -642,7 +642,48 @@ def test_step_function_trace_data(self):
642642 TraceHeader .TRACE_ID : "3675572987363469717" ,
643643 TraceHeader .PARENT_ID : "10713633173203262661" ,
644644 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" ,
646687 },
647688 )
648689 create_dd_dummy_metadata_subsegment (ctx , XraySubsegment .TRACE_KEY )
0 commit comments