Add CSS error sampler coverage (TS021)#7171
Conversation
Add Test_Error_Sampler end-to-end test asserting that traces containing errors are still sent to the agent when sampling would drop them, with a new TRACE_STATS_COMPUTATION_ERROR_SAMPLER scenario. Active for golang, python, dotnet and java; marked missing_feature for ruby and php (with reasons) and cpp (no client-side stats).
|
|
|
vertx does not flag 500 responses as errors, so no error span is produced and the error-sampler assertion cannot hold on those weblogs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 496bf72a1c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Droppable P0 traffic: with sample rate 0 these are dropped from traces but still counted in stats. | ||
| for _ in range(5): | ||
| weblog.get("/") |
There was a problem hiding this comment.
Assert that non-error sampled traces are dropped
Because this loop discards the successful request handles, the test below only proves that an error trace was emitted; it never proves that DD_TRACE_SAMPLE_RATE=0 actually dropped non-error P0 traces. In contexts like Node.js, where manifests/nodejs.yml already records that DD_TRACE_SAMPLE_RATE=0 still emits P0 traces, this scenario can pass while the prerequisite sampling behavior is broken, giving a false activation signal. Please retain these requests and assert they have no emitted spans, or mark unsupported libraries accordingly.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The false-activation risk doesn't apply to the libraries this test runs on.
| def test_error_traces_always_sent(self): | ||
| """Test that error traces are sent and stats are computed when sample rate is 0.""" | ||
| # Client-side stats are computed despite sampling being disabled. | ||
| stats_requests = list(interfaces.library.get_data("/v0.6/stats")) |
There was a problem hiding this comment.
Add the new stats scenario to the schema allow-list
This new scenario reads /v0.6/stats payloads, but the auxiliary schema test's APMSP-2158 allow-list in tests/schemas/test_schemas.py only includes the existing trace-stats scenarios, not trace_stats_computation_error_sampler. When this runs for libraries covered by that known schema bug, Test_DdtraceSchemas.test_library will treat the same stats schema errors as new failures for this scenario. Please add this scenario to the existing known-bug condition or fix the schema before enabling it.
Useful? React with 👍 / 👎.
…P-2158) The new TRACE_STATS_COMPUTATION_ERROR_SAMPLER scenario reads /v0.6/stats, so it is subject to the same known schema bug as the other trace-stats scenarios; add it to the existing allow-list.
tabgok
left a comment
There was a problem hiding this comment.
approved from IDM's standpoint
Motivation
Phase C (APMSP-3049) of the Client-Side Stats v1.2.0 coverage: test the interaction between CSS and the agent error sampler. The agent keeps a portion of error traces, so a tracer with CSS enabled must still send all traces containing an error even when sampling would otherwise drop them.
Changes
Adds
Test_Error_Samplerintests/stats/test_stats.pyand a newTRACE_STATS_COMPUTATION_ERROR_SAMPLERscenario (DD_TRACE_SAMPLE_RATE=0with CSS enabled). The test asserts stats are still computed and error traces are still sent to the agent. Active for golang, python, dotnet and java; markedmissing_featurefor ruby (no stats computed when sampling drops all traces), php (errors counted in stats but error traces dropped client-side) and cpp (no client-side stats).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