Skip to content

CP-44601: Aggregate CloudZeroWebhookNoEvents with sum() to stop per-series misfires - #906

Merged
evan-cz merged 1 commit into
developfrom
CP-44601-webhook-noevents-alert-aggregation
Aug 11, 2026
Merged

CP-44601: Aggregate CloudZeroWebhookNoEvents with sum() to stop per-series misfires#906
evan-cz merged 1 commit into
developfrom
CP-44601-webhook-noevents-alert-aggregation

Conversation

@evan-cz

@evan-cz evan-cz commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Problem

The CloudZeroWebhookNoEvents PrometheusRule alert fires on healthy webhooks. Its expression

rate(czo_webhook_types_total{job="..."}[30m]) == 0

is evaluated per series. czo_webhook_types_total is a counter split by kind_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(rate(czo_webhook_types_total{job="..."}[30m])) or vector(0)) == 0
  • 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.md are updated to match.

Verification

  • helm template renders the corrected expression.
  • helm-unittest webhookserver_gating_test.yaml passes 36/36.

This PR was created with AI assistance (Claude Code by Anthropic).

@evan-cz
evan-cz force-pushed the CP-44601-webhook-noevents-alert-aggregation branch 2 times, most recently from 61da3b6 to 30b8dd6 Compare July 14, 2026 19:20
@evan-cz
evan-cz marked this pull request as ready for review July 14, 2026 19:29
@evan-cz
evan-cz requested a review from a team as a code owner July 14, 2026 19:29
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown

Greptile Summary

Fixes the CloudZeroWebhookNoEvents PrometheusRule alert so it no longer fires spuriously on quiet-but-healthy individual metric series, and now correctly fires when the webhook is genuinely silent from startup.

  • PromQL fix: replaces the bare rate(...) == 0 (evaluated per series) with (sum(rate(...)) or vector(0)) == 0, collapsing all label and pod dimensions into a single fleet-wide rate and substituting 0 when the counter is absent.
  • Comment: adds a detailed inline explanation in the template justifying both the sum() and or vector(0) requirements.
  • Docs: updates helm/docs/monitoring-infrastructure.md to reflect the new sum(rate) == 0 condition and its intent.

Confidence Score: 5/5

  • Safe to merge — the change narrows a noisy alert to fire only on genuine fleet-wide silence, and the absent-metric case is correctly handled with or vector(0).
  • Both the spurious-fire bug (per-series evaluation) and the never-fires bug (absent metric returns empty vector) are addressed correctly. The alert's explicit labels: block (severity: critical, component: webhook) preserves all Alertmanager routing context that the bare sum() would otherwise strip. The template comment and documentation are thorough and accurate.
  • No files require special attention.

Important Files Changed

Filename Overview
helm/templates/prometheusrule.yaml Fixes CloudZeroWebhookNoEvents alert expression by wrapping with sum() to collapse per-label/per-pod series into a single fleet-wide rate, and adding or vector(0) to handle the absent-metric case. The updated comment thoroughly documents both problems and why each part of the fix is required. Routing labels (severity: critical, component: webhook) are explicitly set in the alert labels: block, so no label context is lost from sum() stripping metric labels.
helm/docs/monitoring-infrastructure.md Documentation updated to reflect the corrected sum(rate) == 0 condition and adds a brief explanation of the fleet-wide aggregation and or vector(0) fallback. Formatting-only change otherwise (column width adjustments).

Reviews (2): Last reviewed commit: "CP-44601: Aggregate CloudZeroWebhookNoEv..." | Re-trigger Greptile

…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>
@evan-cz
evan-cz force-pushed the CP-44601-webhook-noevents-alert-aggregation branch from 30b8dd6 to f271de6 Compare August 10, 2026 22:37
@evan-cz
evan-cz added this pull request to the merge queue Aug 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 10, 2026
@evan-cz
evan-cz added this pull request to the merge queue Aug 11, 2026
Merged via the queue into develop with commit dc94e2f Aug 11, 2026
45 checks passed
@evan-cz
evan-cz deleted the CP-44601-webhook-noevents-alert-aggregation branch August 11, 2026 02:27
dmepham added a commit that referenced this pull request Aug 11, 2026
Per Evan's review, reframe the notes as the routine maintenance release
they are rather than an incident response:
- Drop the dedicated Security section and CVE links; fold the x/net and
  x/text updates into Build & Infrastructure as routine dependency
  updates flagged by vulnerability scanners (no known reachability or
  severity claimed).
- Scope the config-loader bug fix to the optional, non-default
  webhook-disable path; note default installs were unaffected.
- Remove the "upgrade promptly" urgency language, matching 1.2.11.
- Add two of Evan's webhook fixes: CloudZeroWebhookNoEvents alert
  false-alarms (#906) and anaximander RBAC-vs-absent-VWC diagnostics
  (#908).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Cp5HSjxdMed1oiCx9rymw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants