Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions tests/parametric/test_span_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ def test_single_rule_with_head_and_rule_trace_sampling_keep_019(
"DD_TRACE_PROPAGATION_STYLE": "datadog",
"DD_SPAN_SAMPLING_RULES": json.dumps([{"name": "web.request", "sample_rate": 0.0}]),
"DD_TRACE_SAMPLING_RULES": json.dumps([{"name": "web.request", "sample_rate": 0.0}]),
"DD_TRACE_STATS_COMPUTATION_ENABLED": "false", # Disable stats computation to send P0s
}
],
)
Expand Down Expand Up @@ -876,9 +877,7 @@ def test_single_rule_with_head_and_rule_trace_sampling_drop_020(

test_library.dd_flush()

tracer_sends_p0 = context.library.name != "java" or context.library.version <= "1.54"

traces = test_agent.wait_for_num_traces(2 if tracer_sends_p0 else 1)
traces = test_agent.wait_for_num_traces(2)

case1 = find_span_in_traces(traces, s1.trace_id, s1.span_id)
# Assert the RUM origin is set
Expand All @@ -893,16 +892,15 @@ def test_single_rule_with_head_and_rule_trace_sampling_drop_020(
assert SINGLE_SPAN_SAMPLING_RATE not in case1["metrics"]
assert SINGLE_SPAN_SAMPLING_MAX_PER_SEC not in case1["metrics"]

if tracer_sends_p0:
case2 = find_span_in_traces(traces, s2.trace_id, s2.span_id)
# Assert the RUM origin is set
assert case2["meta"]["_dd.origin"] == "rum"
# Assert the propagated sampling priority is unaffected
assert case2["metrics"].get(SAMPLING_PRIORITY_KEY) == 0
# Assert that there is no trace sampling happening
assert "_dd.p.dm" not in case2["meta"]
assert "_dd.rule_psr" not in case2["meta"]
# Assert that there is no single span sampling happening
assert SINGLE_SPAN_SAMPLING_MECHANISM not in case1["metrics"]
assert SINGLE_SPAN_SAMPLING_RATE not in case1["metrics"]
assert SINGLE_SPAN_SAMPLING_MAX_PER_SEC not in case1["metrics"]
case2 = find_span_in_traces(traces, s2.trace_id, s2.span_id)
# Assert the RUM origin is set
assert case2["meta"]["_dd.origin"] == "rum"
# Assert the propagated sampling priority is unaffected
assert case2["metrics"].get(SAMPLING_PRIORITY_KEY) == 0
# Assert that there is no trace sampling happening
assert "_dd.p.dm" not in case2["meta"]
assert "_dd.rule_psr" not in case2["meta"]
# Assert that there is no single span sampling happening
assert SINGLE_SPAN_SAMPLING_MECHANISM not in case1["metrics"]
assert SINGLE_SPAN_SAMPLING_RATE not in case1["metrics"]
assert SINGLE_SPAN_SAMPLING_MAX_PER_SEC not in case1["metrics"]
Loading