← Back to Pull requests

pkg/dyninst: snapshot correlation sampling #56772

Closed
unknown closed this pull request without merging on Oct 21, 2026 17:48 UTC
View on GitHub
unknown unknown commented on Sep 22, 2026 19:50 UTC
Author

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.

Diff: 208 lines (+156 / -52) across 2 files Reviewer: grantseltzer Review duration: 41638m
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
0.36
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.320
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #56772"
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: 36.4% (MEDIUM) · Higher = larger blast radius
36.4%
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: 14.4% · Safe to merge
14.4%