fix(parametric): wait for client-side stats before asserting p0 dropping#7326
Merged
Conversation
`test_*_when_dropping_policy_is_active016/017/018` asserted client-side p0 dropping immediately after tracer startup. p0 dropping only activates once the tracer's async `/info` fetch confirms the agent supports it, so a span flushed before that handshake is forwarded to the agent undropped. This is a startup race, not a tracer bug (dd-trace -java and dd-trace-dotnet also send p0 traces until `/info` lands; the agent recomputes stats and drops them). It surfaced as a flaky `[parametric-rust]` failure because the test is enabled for few tracers and rust's `/info` fetch can lose the race. Add `_wait_for_client_side_stats_active`: warm up until the agent receives a `/v0.6/stats` payload (proving stats / p0 dropping are active), then clear, before running the assertions. Reuses the existing `TestAgentAPI.wait_for_num_v06_stats` polling primitive and mirrors the `wait_for_client_side_stats_payload` approach used by the stats tests. Applied to all three dropping-policy tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
|
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 8f33a11 | Docs | Datadog PR Page | Give us feedback! |
mhlidd
approved these changes
Jul 16, 2026
VianneyRuhlmann
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
test_*_when_dropping_policy_is_active016/017/018intests/parametric/test_span_sampling.pyassert client-side p0 dropping right after tracer startup. p0 dropping only turns on once the tracer's async/infofetch confirms the agent supports it, so a span flushed before that handshake completes is forwarded to the agent undropped. That is a startup race, not a tracer bug: dd-trace-java and dd-trace-dotnet also send p0 traces until/infolands, and the agent recomputes stats and drops them. It surfaced as a flaky[parametric-rust]failure because the test is enabled for few tracers and rust's/infofetch can lose the race. Approach confirmed with Vianney Ruhlmann in #apm-client-side-stats.Changes
Add
_wait_for_client_side_stats_active: before the assertions, warm up until the test agent receives a/v0.6/statspayload (which proves stats and p0 dropping are active), then clear the warm-up traffic. Reuses the existingTestAgentAPI.wait_for_num_v06_statsprimitive and mirrors thewait_for_client_side_stats_payloadapproach the stats tests already use. Applied to all three dropping-policy tests (016/017/018).Only
tests/is modified.Workflow
🚀 Once your PR is reviewed and the CI green, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist
tests/ormanifests/is modified ? I have the approval from R&P teambuild-XXX-imagelabel is present