@@ -284,6 +284,7 @@ def test_extract(tracer): # noqa: F811
284284 assert span .context .dd_origin == "synthetics"
285285 assert span .context ._meta == {
286286 "_dd.origin" : "synthetics" ,
287+ "_dd.p.dm" : "-3" ,
287288 "_dd.p.test" : "value" ,
288289 }
289290 with tracer .trace ("child_span" ) as child_span :
@@ -293,6 +294,7 @@ def test_extract(tracer): # noqa: F811
293294 assert child_span .context .dd_origin == "synthetics"
294295 assert child_span .context ._meta == {
295296 "_dd.origin" : "synthetics" ,
297+ "_dd.p.dm" : "-3" ,
296298 "_dd.p.test" : "value" ,
297299 }
298300
@@ -464,6 +466,7 @@ def test_extract_unicode(tracer): # noqa: F811
464466
465467 assert span .context ._meta == {
466468 "_dd.origin" : "synthetics" ,
469+ "_dd.p.dm" : "-3" ,
467470 "_dd.p.test" : "value" ,
468471 }
469472 with tracer .trace ("child_span" ) as child_span :
@@ -473,6 +476,7 @@ def test_extract_unicode(tracer): # noqa: F811
473476 assert child_span .context .dd_origin == "synthetics"
474477 assert child_span .context ._meta == {
475478 "_dd.origin" : "synthetics" ,
479+ "_dd.p.dm" : "-3" ,
476480 "_dd.p.test" : "value" ,
477481 }
478482
@@ -526,6 +530,7 @@ def test_WSGI_extract(tracer): # noqa: F811
526530 assert span .context ._meta == {
527531 "_dd.origin" : "synthetics" ,
528532 "_dd.p.test" : "value" ,
533+ "_dd.p.dm" : "-3" ,
529534 }
530535
531536
@@ -549,6 +554,7 @@ def test_extract_invalid_tags(tracer): # noqa: F811
549554 assert span .context .dd_origin == "synthetics"
550555 assert span .context ._meta == {
551556 "_dd.origin" : "synthetics" ,
557+ "_dd.p.dm" : "-3" ,
552558 "_dd.propagation_error" : "decoding_error" ,
553559 }
554560
@@ -573,6 +579,7 @@ def test_extract_tags_large(tracer): # noqa: F811
573579 assert span .context .dd_origin == "synthetics"
574580 assert span .context ._meta == {
575581 "_dd.origin" : "synthetics" ,
582+ "_dd.p.dm" : "-3" ,
576583 "_dd.propagation_error" : "extract_max_size" ,
577584 }
578585
@@ -1124,6 +1131,7 @@ def test_extract_tracecontext(headers, expected_context):
11241131 "span_id" : 5678 ,
11251132 "sampling_priority" : 1 ,
11261133 "dd_origin" : "synthetics" ,
1134+ "meta" : {"_dd.p.dm" : "-3" },
11271135 },
11281136 ),
11291137 (
@@ -1135,6 +1143,7 @@ def test_extract_tracecontext(headers, expected_context):
11351143 "span_id" : 5678 ,
11361144 "sampling_priority" : 1 ,
11371145 "dd_origin" : "synthetics" ,
1146+ "meta" : {"_dd.p.dm" : "-3" },
11381147 },
11391148 ),
11401149 (
@@ -1152,6 +1161,7 @@ def test_extract_tracecontext(headers, expected_context):
11521161 "span_id" : 5678 ,
11531162 "sampling_priority" : 1 ,
11541163 "dd_origin" : "synthetics" ,
1164+ "meta" : {"_dd.p.dm" : "-3" },
11551165 },
11561166 ),
11571167 (
@@ -1174,6 +1184,7 @@ def test_extract_tracecontext(headers, expected_context):
11741184 "span_id" : 5678 ,
11751185 "sampling_priority" : 1 ,
11761186 "dd_origin" : "synthetics" ,
1187+ "meta" : {"_dd.p.dm" : "-3" },
11771188 },
11781189 ),
11791190 (
@@ -1185,6 +1196,7 @@ def test_extract_tracecontext(headers, expected_context):
11851196 "span_id" : 5678 ,
11861197 "sampling_priority" : 1 ,
11871198 "dd_origin" : "synthetics" ,
1199+ "meta" : {"_dd.p.dm" : "-3" },
11881200 },
11891201 ),
11901202 (
@@ -1417,6 +1429,7 @@ def test_extract_tracecontext(headers, expected_context):
14171429 "span_id" : 5678 ,
14181430 "sampling_priority" : 1 ,
14191431 "dd_origin" : "synthetics" ,
1432+ "meta" : {"_dd.p.dm" : "-3" },
14201433 "span_links" : [
14211434 SpanLink (
14221435 trace_id = TRACE_ID ,
@@ -1444,6 +1457,7 @@ def test_extract_tracecontext(headers, expected_context):
14441457 "span_id" : 5678 ,
14451458 "sampling_priority" : 1 ,
14461459 "dd_origin" : "synthetics" ,
1460+ "meta" : {"_dd.p.dm" : "-3" },
14471461 "span_links" : [
14481462 SpanLink (
14491463 trace_id = TRACE_ID ,
@@ -1483,6 +1497,7 @@ def test_extract_tracecontext(headers, expected_context):
14831497 "span_id" : 5678 ,
14841498 "sampling_priority" : 1 ,
14851499 "dd_origin" : "synthetics" ,
1500+ "meta" : {"_dd.p.dm" : "-3" },
14861501 "span_links" : [
14871502 SpanLink (
14881503 trace_id = TRACE_ID ,
@@ -1517,6 +1532,7 @@ def test_extract_tracecontext(headers, expected_context):
15171532 "span_id" : 5678 ,
15181533 "sampling_priority" : 1 ,
15191534 "dd_origin" : "synthetics" ,
1535+ "meta" : {"_dd.p.dm" : "-3" },
15201536 },
15211537 ),
15221538 (
@@ -1528,6 +1544,7 @@ def test_extract_tracecontext(headers, expected_context):
15281544 "span_id" : 5678 ,
15291545 "sampling_priority" : 1 ,
15301546 "dd_origin" : "synthetics" ,
1547+ "meta" : {"_dd.p.dm" : "-3" },
15311548 },
15321549 ),
15331550 (
@@ -1596,6 +1613,7 @@ def test_extract_tracecontext(headers, expected_context):
15961613 "span_id" : 5678 ,
15971614 "sampling_priority" : 1 ,
15981615 "dd_origin" : "synthetics" ,
1616+ "meta" : {"_dd.p.dm" : "-3" },
15991617 },
16001618 ),
16011619 # Testing that order matters
@@ -1664,7 +1682,7 @@ def test_extract_tracecontext(headers, expected_context):
16641682 "span_id" : 5678 ,
16651683 "sampling_priority" : 1 ,
16661684 "dd_origin" : "synthetics" ,
1667- "meta" : {"tracestate" : TRACECONTEXT_HEADERS_VALID [_HTTP_HEADER_TRACESTATE ]},
1685+ "meta" : {"tracestate" : TRACECONTEXT_HEADERS_VALID [_HTTP_HEADER_TRACESTATE ], "_dd.p.dm" : "-3" },
16681686 },
16691687 ),
16701688 # testing that tracestate is not added when tracecontext style comes later and does not match first style's trace-id
@@ -1677,6 +1695,7 @@ def test_extract_tracecontext(headers, expected_context):
16771695 "span_id" : 5678 ,
16781696 "sampling_priority" : 1 ,
16791697 "dd_origin" : "synthetics" ,
1698+ "meta" : {"_dd.p.dm" : "-3" },
16801699 "span_links" : [
16811700 SpanLink (
16821701 trace_id = TRACE_ID ,
@@ -1958,7 +1977,7 @@ def test_DD_TRACE_PROPAGATION_STYLE_EXTRACT_overrides_DD_TRACE_PROPAGATION_STYLE
19581977 Context (
19591978 trace_id = 13088165645273925489 ,
19601979 span_id = 5678 ,
1961- meta = {"_dd.origin" : "synthetics" },
1980+ meta = {"_dd.origin" : "synthetics" , "_dd.p.dm" : "-3" },
19621981 metrics = {"_sampling_priority_v1" : 1 },
19631982 span_links = [
19641983 SpanLink (
@@ -2001,7 +2020,14 @@ def test_DD_TRACE_PROPAGATION_STYLE_EXTRACT_overrides_DD_TRACE_PROPAGATION_STYLE
20012020 Context (
20022021 trace_id = 7277407061855694839 ,
20032022 span_id = 5678 ,
2004- meta = {"_dd.origin" : "synthetics" , "tracestate" : "dd=s:2;o:rum;t.dm:-4;t.usr.id:baz64,congo=t61rcWkgMzE" },
2023+ # it's weird that both _dd.p.dm and tracestate.t.dm are set here. as far as i know, this is the expected
2024+ # behavior for this chaotic set of headers, specifically when STYLE_DATADOG precedes STYLE_W3C_TRACECONTEXT
2025+ # in the styles configuration
2026+ meta = {
2027+ "_dd.p.dm" : "-3" ,
2028+ "_dd.origin" : "synthetics" ,
2029+ "tracestate" : "dd=s:2;o:rum;t.dm:-4;t.usr.id:baz64,congo=t61rcWkgMzE" ,
2030+ },
20052031 metrics = {"_sampling_priority_v1" : 1 },
20062032 span_links = [
20072033 SpanLink (
@@ -2018,7 +2044,7 @@ def test_DD_TRACE_PROPAGATION_STYLE_EXTRACT_overrides_DD_TRACE_PROPAGATION_STYLE
20182044
20192045
20202046@pytest .mark .parametrize ("name,styles,headers,expected_context" , FULL_CONTEXT_EXTRACT_FIXTURES )
2021- def test_mutliple_context_interactions (name , styles , headers , expected_context ):
2047+ def test_multiple_context_interactions (name , styles , headers , expected_context ):
20222048 with override_global_config (dict (_propagation_style_extract = styles )):
20232049 context = HTTPPropagator .extract (headers )
20242050 assert context == expected_context
0 commit comments