datadog_cluster_agent: compute count deltas in the check to survive leader elections #26123
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.42) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 348 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.350
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #26123"
general
weight: 0.35
gabedos
What does this PR do?
Computes count deltas in the check instead of in the Agent. Each
monotonic_countsubmission (counters and histogram/summary.count/.sum) is diffed against the series' last value under a key that ignoresis_leader, then sent as acountwith the currentis_leadertag.Motivation
The check joins
is_leaderonto every metric. On a leader election every count gets a new tag set. The Agent keys counter state on the full tag set, so it sees a new context and, after the first scrape, flushes its first value, i.e. the counter's lifetime total, as one delta.Pros
is_leaderstays on counts; existing queries, monitors and the dashboard keep working.Cons
Regression risks
flush_first_valueis on.monotonic_counttocount. Backend type iscounteither way, so queries don't change; anything asserting monotonic submissions (tests, subclasses) does.send_distribution_buckets: true, histograms skip themonotonic_countoverride, so they keepis_leaderbut still spike on a flip:admission_webhooks.response_duration,admission_webhooks.cws_response_duration,autodiscovery.poll_duration,autoscaling.workload.queue_latency,autoscaling.workload.queue_work_duration,external_metrics.api_elapsed. In default mode they're covered.Alternatives considered
is_leaderfrom counts (first version of this PR). Counts can't be split by leader.flush_first_value. Loses new series' first values; a demoted leader still spikes.Checklist before requesting review
🤖 Generated with Claude Code