← Back to Pull requests

test(debugger): add snapshot correlation tests with Go, .NET and Node.js weblog endpoints #7425

Closed
unknown closed this pull request without merging on Oct 23, 2026 15:50 UTC
View on GitHub
unknown unknown commented on Jul 30, 2026 18:30 UTC
Author

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).

[!NOTE]

Taken over from @grantseltzer, with his permission, by @watson. The branch was rebased onto main and the remaining issues fixed. The Node.js enablement, previously stacked on top in #7985, is now part of this PR.

Changes

Tests:

  • Test_Debugger_Coordinated_Sampling sends 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_Probe runs 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_budget probes 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:

  • Go: endpoints in chi, echo, gin, net-http and net-http-orchestrion, with the Go line mappings.

  • .NET: controller methods.

  • Node.js: endpoints in the Express, TypeScript Express and Fastify weblogs, with identical line numbers in all three.

  • - 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 CaptureTimeout line from 157 to 159 and Budgets from 163 to 165.
    - The base-image lock and the Node.js entries of the image mirror files are refreshed for the changed fixtures.

    Manifests:

  • .NET: enables the method-probe variant from 3.55.0.

  • Node.js: enables the line-probe variant and test_per_trace_budget from >=6.21.0 || ^5.132.0 (a new ref_6_21_0), and marks the method-probe variant as irrelevant.

  • Java: 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.

  • Everything else: missing_feature, or irrelevant for the line-probe variant.
  • Fixes made while taking this over:

  • Rebased onto main.

  • The using System.Runtime.CompilerServices; added to the .NET DebuggerController.cs moved every line of the file down by one, which broke all existing .NET line-probe tests. The MethodImpl attributes are now fully qualified instead.

  • Includes #7572's approved commit, which accepts the flat dd.trace_id key that .NET sends.

  • Documented /debugger/correlation/loop/<count>, which a review comment asked for.

  • Made Test_Debugger_Coordinated_Sampling discriminating. 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.js routes 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 dev and prod. The Node.js jobs run the line-probe variant and test_per_trace_budget.

    Checks:

  • ./format.sh --check: mypy, import policy, ruff, yamlfmt, yamllint, the manifest parser and shellcheck pass.

  • The Node.js linter step needs Docker, so I ran ESLint from the Express and Fastify weblog setups directly on their debugger/index.js: both pass.

  • The TypeScript weblog file type-checks with tsc --strict against a minimal Express type stub.
  • Not addressed here:

  • The newer Go weblogs fiber-v2-orchestrion and net-http-span-pool don't have the correlation endpoints yet. Go's manifest keeps these tests disabled.

  • The RFC's follow-up gaps, runtime_id in 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

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: grantseltzer Review duration: 122240m
    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
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%