pkg/dyninst: snapshot correlation sampling #56772
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 208 lines diff across 2 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.320
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #56772"
general
weight: 0.35
grantseltzer
What does this PR do?
Adds coordinated sampling to the Go Live Debugger so a request's snapshots stay together.
This PR changes sampling logic to now make a decision once for snapshots in the same trace:
- On probe fire, read the request's trace ID from the in-scope context.Context
- The first probe to fire for a trace decides keep/drop via the normal rate limiter and records it; every later probe in that trace follows the same decision. So you get the whole chain or none of it.
- Each probe emits at most one snapshot per trace, so a probe in a big loop can't flood.
- Kept snapshots still count against the global per-second budget.
- If there's no context.Context in scope we falls back to today's per-probe behavior.
### Motivation
Before this change sampling decisions are local to individual probes, rather than coordinated within a session. Snapshots would be sampled out, unbeknownst to users.
### Describe how you validated your changes
- Built the eBPF from this branch, loaded it in-kernel, and ran the full pkg/dyninst suite on amd64 (incl. the end-to-end TestDyninst on programs that capture context.Context). All pass: it loads/verifies
(normal and -debug), capture still works, and the no-context fallback is unchanged.
- Fixed four real BPF verifier/stack issues found by loading it (working state moved to per-CPU scratch; walk/decision made noinline).
- Added a Go unit test for locating a probe's context.Context.
### Additional Notes
Design and full status in pkg/dyninst/docs/coordinated-sampling-plan.md. loader/types_linux.go (generated) is regenerated for a new probe_params_t field.