CP-44601: Aggregate CloudZeroWebhookNoEvents with sum() to stop per-series misfires#906
CP-44601: Aggregate CloudZeroWebhookNoEvents with sum() to stop per-series misfires#906evan-cz wants to merge 1 commit into
Conversation
3b98b65 to
61da3b6
Compare
…eries misfires The CloudZeroWebhookNoEvents alert used a bare per-series expression (rate(czo_webhook_types_total[30m]) == 0) that fired whenever any single series was flat -- a rarely-seen resource/operation, or one quiet replica -- even while the webhook was healthy and busy overall. It also never fired on a webhook that had received nothing since startup, because the counter has no series until the first admission event is processed. Aggregate fleet-wide with sum(rate(...)) and add "or vector(0)" so genuine silence (an absent metric) still fires. Update the template comment and the monitoring-infrastructure alert reference to match. Verified: helm template renders the corrected expression; helm-unittest webhookserver_gating_test.yaml passes 36/36. Co-Authored-By: Claude opus-4.8 <noreply@anthropic.com>
61da3b6 to
30b8dd6
Compare
Greptile SummaryThis PR fixes the
Confidence Score: 5/5Safe to merge — this is a targeted, well-reasoned fix to an alerting rule with no impact on data collection or delivery paths. The PromQL expression change is correct: sum() without a by() clause collapses all per-series data into a single fleet-wide instant vector, and or vector(0) correctly substitutes 0 when the metric is absent rather than returning an empty vector. Label stripping from sum() is intentional here — this is a fleet-wide signal, so a single unlabeled alert instance is exactly right. The for: 30m and [30m] window combination is unchanged and well-understood. The comment block added to the template is unusually thorough and will prevent future regressions. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "CP-44601: Aggregate CloudZeroWebhookNoEv..." | Re-trigger Greptile |
Problem
The
CloudZeroWebhookNoEventsPrometheusRule alert fires on healthy webhooks. Its expressionis evaluated per series.
czo_webhook_types_totalis a counter split bykind_group/kind_version/kind_resource/operation(and per pod/instance by the scrape), so the alert fires whenever any single series is flat for 30m — a rarely-seen resource/operation (e.g. storageclass creates) or one quiet replica — even while the webhook is healthy and busy overall.It also never fires in the case it is meant to catch: the counter has no series until the first admission event, so a webhook that is up but receiving nothing produces an absent metric and an empty result.
Fix
sum()collapses the per-label and per-pod series into a single fleet-wide rate, so the alert fires only when no replica sees any admission event of any type.or vector(0)substitutes 0 when the metric is absent, so genuine silence still fires.The template comment and
helm/docs/monitoring-infrastructure.mdare updated to match.Verification
helm templaterenders the corrected expression.webhookserver_gating_test.yamlpasses 36/36.This PR was created with AI assistance (Claude Code by Anthropic).