File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,41 @@ def test_with_complete_datadog_trace_headers(self):
191191 expected_context ,
192192 )
193193
194+ def test_with_w3c_trace_headers (self ):
195+ lambda_ctx = get_mock_context ()
196+ ctx , source , event_source = extract_dd_trace_context (
197+ {
198+ "headers" : {
199+ "traceparent" : "00-0000000000000000000000000000007b-0000000000000141-01" ,
200+ }
201+ },
202+ lambda_ctx ,
203+ )
204+ self .assertEqual (source , "event" )
205+ expected_context = Context (
206+ trace_id = 123 ,
207+ span_id = 321 ,
208+ sampling_priority = 1 ,
209+ meta = {
210+ "traceparent" : "00-0000000000000000000000000000007b-0000000000000141-01"
211+ },
212+ )
213+ self .assertEqual (ctx , expected_context )
214+ self .assertEqual (
215+ get_dd_trace_context (),
216+ Context (
217+ trace_id = 123 ,
218+ span_id = fake_xray_header_value_parent_decimal ,
219+ sampling_priority = 1 ,
220+ ),
221+ )
222+ create_dd_dummy_metadata_subsegment (ctx , XraySubsegment .TRACE_KEY )
223+ self .mock_send_segment .assert_called ()
224+ self .mock_send_segment .assert_called_with (
225+ XraySubsegment .TRACE_KEY ,
226+ expected_context ,
227+ )
228+
194229 def test_with_extractor_function (self ):
195230 def extractor_foo (event , context ):
196231 foo = event .get ("foo" , {})
You can’t perform that action at this time.
0 commit comments