test(debugger): add snapshot correlation tests with Go, .NET and Node.js weblog endpoints #7425
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7425"
general
weight: 0.35
grantseltzer
Motivation
The RFC: Improving Correlation for Live Debugger Snapshots asks tracers to make one snapshot sampling decision per trace, so a trace emits its whole probe chain or none of it, and to cap each probe at one snapshot per trace. This adds the shared tests for that behavior (feature 564) and the weblog endpoints they need. It enables them for .NET (DataDog/dd-trace-dotnet#9266) and Node.js (DataDog/dd-trace-js#10677, DEBUG-5831).
Changes
Tests:
Test_Debugger_Coordinated_Samplingsends 30 requests to/debugger/correlation. It asserts that every trace emits either all of the chain's probes or none of them, with at least one full chain.- The leaf probe is hit first and makes the trace's decision, and it samples every request.
- The other probes are limited to one snapshot per second, so independent per-probe sampling emits partial chains.
-
Test_Debugger_Coordinated_Sampling_Line_Proberuns the same test with line probes on the line each method returns on, for tracers without method probes. It's activated through the manifests, like the evaluation timeout guardrail variants.Test_Debugger_Probe_Budgets::test_per_trace_budgetprobes a loop body and a sibling line via/debugger/correlation/loop/:count. It asserts exactly one snapshot per probe per request, which is one trace.Weblogs, all documented in
end-to-end_weblog.md:chi,echo,gin,net-httpandnet-http-orchestrion, with the Go line mappings.- The probed functions return about 0, 400 and 800ms into the request, using real async sleeps.
- The additions avoid everything the IAST rewriter instruments (
+,+=, template literals and some string methods). The debugger scenarios run with IAST enabled, and Dynamic Instrumentation places line probes two lines too early in a file the rewriter rewrites.- The new routes move the Node.js
CaptureTimeoutline from 157 to 159 andBudgetsfrom 163 to 165.- The base-image lock and the Node.js entries of the image mirror files are refreshed for the changed fixtures.
Manifests:
test_per_trace_budgetfrom>=6.21.0 || ^5.132.0(a newref_6_21_0), and marks the method-probe variant as irrelevant.incomplete_test_app. dd-trace-java 1.67.0 implements coordinated sampling and the per-trace cap, but the Java weblog has no correlation endpoints yet.missing_feature, orirrelevantfor the line-probe variant.Fixes made while taking this over:
main.using System.Runtime.CompilerServices;added to the .NETDebuggerController.csmoved every line of the file down by one, which broke all existing .NET line-probe tests. TheMethodImplattributes are now fully qualified instead.dd.trace_idkey that .NET sends./debugger/correlation/loop/<count>, which a review comment asked for.Test_Debugger_Coordinated_Samplingdiscriminating. With the same rate on every probe, independent samplers stayed in lockstep and also emitted only whole chains, so the test passed without coordinated sampling.Testing
The real Node.js
express/debugger/index.jsroutes ran under dd-trace-js with a fake agent and IAST enabled, as in CI, replaying both scenarios with the same probes:| dd-trace-js |
/debugger/correlation×30 |/debugger/correlation/loop/3|| --- | --- | --- |
| Before DataDog/dd-trace-js#10677 | 15 full chains, 15 partial | body: 3 snapshots, sibling: 1 snapshot |
| With DataDog/dd-trace-js#10677 | 30 full chains, 0 partial | body: 1 snapshot, sibling: 1 snapshot |
With IAST enabled and disabled, a snapshot probe on each mapped Node.js line (20, 159, 165, 178, 184, 188, 194 and 197) pauses on exactly that line.
In CI, all .NET and Node.js end-to-end jobs pass, on both
devandprod. The Node.js jobs run the line-probe variant andtest_per_trace_budget.Checks:
./format.sh --check: mypy, import policy, ruff, yamlfmt, yamllint, the manifest parser and shellcheck pass.debugger/index.js: both pass.tsc --strictagainst a minimal Express type stub.Not addressed here:
fiber-v2-orchestrionandnet-http-span-pooldon't have the correlation endpoints yet. Go's manifest keeps these tests disabled.runtime_idin the snapshot envelope and an execution-context generation token. An earlier version of this PR tested both. Runtime ID is on hold, and no tracer sends a generation token yet, with no agreed field for it, so the test was removed.Workflow
1. ⚠️ Create your PR as draft ⚠️
2. Work on you PR until the CI passes
3. Mark it as ready for review
Tests, manifest, weblog are modified -> you'll need a review from
system-tests-reviewers: ask to one of youre co-worker familiar with the tested feature.Framework is modified, or non obvious usage of it -> get a review from
system-tests-core(slack):rocket: Once your PR is reviewed and the CI green, you can merge it!
🛟 #apm-shared-testing 🛟
🤖 Generated with Claude Code
[DEBUG-5831]: https://datadoghq.atlassian.net/browse/DEBUG-5831?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ