monitoring(hubble): split ring-buffer reads out of the flow-loss gate

HubbleFlowWindowIncomplete was paging on all three nodes with
perf_event_ring_buffer and observer_events_queue at 0: the gate recorder was
increase(hubble_lost_events_total{source="hubble_ring_buffer"}[30m]), and that
counter also counts *reads* that fall outside the ring's retained window
(cilium#46584, still open in 1.20.1). Two Hubble UI/status reads an hour
(18:27, 18:35, same minutes on every node) moved it +1 each, which kept the
recorder at ~2.01 and the alert true forever. HubbleFlowLossMaterial used the
same recorder, so a handful of reads could also read as 0.03% "loss" on the
quiet Pi node.

- hubble:lost_events_increase_30m is now real loss only, per (node, source):
  increase(hubble_lost_events_total{source=~"perf_event_ring_buffer|observer_events_queue"}[30m]).
  HubbleFlowWindowIncomplete and HubbleFlowLossMaterial read it with unchanged
  thresholds, so they fire only when something was actually dropped.
- hubble_ring_buffer gets hubble:ring_buffer_read_rate_15m and the new
  HubbleRingBufferReadChurn warning at > 0.05 events/s (15m rate, 10m for).
  Current churn is ~0.001/s; the F10 health-probe storm was ~0.2/s.
- Both summaries name the source, so a read is never reported as a dropped
  flow. HubbleFlowSensorMissing unchanged.

No change to hubble.eventBufferCapacity and no Cilium roll. Docs
(docs/hubble-event-loss.md §"The gate") updated with the split and the
measured reason.

Task: t_397d180a
This commit is contained in:
Lance Walters 2026-11-27 18:46:35 -05:00
commit 3010c980ec
2 changed files with 122 additions and 30 deletions

View file

@ -129,17 +129,26 @@ silent. So the sensor contract is:
> **A 30-minute window with any lost event may not be reported as clean.**
The counter carries two different signals and the gate must not treat them
alike: `perf_event_ring_buffer` / `observer_events_queue` are real loss on the
way in, while `hubble_ring_buffer` also counts *reads* that fall outside the
ring's retained window (the artefact above). A read is not a lost event, so the
gate value is built from the two real-loss sources only, and read churn gets its
own rate-based regression guard.
Threshold and enforcement:
| rule | expression | meaning |
|---|---|---|
| `hubble:lost_events_increase_30m` (recorder) | `sum by (node) (increase(hubble_lost_events_total{source="hubble_ring_buffer"}[30m]))` | the gate value: any non-zero → window incomplete |
| `hubble:lost_events_increase_30m` (recorder) | `sum by (node, source) (increase(hubble_lost_events_total{source=~"perf_event_ring_buffer\|observer_events_queue"}[30m]))` | the gate value: any non-zero **real** loss → window incomplete; `source` is kept so the alert can name it |
| `hubble:ring_buffer_read_rate_15m` (recorder) | `sum by (node) (rate(hubble_lost_events_total{source="hubble_ring_buffer"}[15m]))` | read churn on the ring, events/s |
| `hubble:flows_processed_increase_30m` (recorder) | `sum by (node) (increase(hubble_flows_processed_total{type="Trace"}[30m]))` | denominator for the ratio |
| `HubbleFlowWindowIncomplete` (warning) | `hubble:lost_events_increase_30m > 0` for 10 m | a flow-shaped detector may not call this window clean |
| `HubbleFlowLossMaterial` (critical) | `lost / processed > 0.001` for 15 m | loss that is material, not a boundary artefact |
| `HubbleFlowWindowIncomplete` (warning) | `hubble:lost_events_increase_30m > 0` for 10 m | a flow-shaped detector may not call this window clean — real loss only |
| `HubbleRingBufferReadChurn` (warning) | `hubble:ring_buffer_read_rate_15m > 0.05` for 10 m | status-call storm / ring under a minute of flows; **reads, not drops** |
| `HubbleFlowLossMaterial` (critical) | `sum by (node) (hubble:lost_events_increase_30m) / flows > 0.001` for 15 m | real loss that is material, not a boundary artefact |
| `HubbleFlowSensorMissing` (critical) | `absent(hubble:flows_processed_increase_30m)` for 15 m | no input at all; the gate cannot even be evaluated |
All four live in `monitoring/controllers/home/hubble-loss-gate.yaml`
All five live in `monitoring/controllers/home/hubble-loss-gate.yaml`
(Flux → `monitoring` Kustomization), so they evaluate against the same
Prometheus the detectors read and route to Alertmanager.
@ -147,7 +156,32 @@ Prometheus the detectors read and route to Alertmanager.
over the *same* range; if `hubble:lost_events_increase_30m > 0` for the node(s)
in scope, the result is `incomplete` — never "no anomalous traffic". Alerting on
silence (absence of an expected event) is the case that matters most: a lossy
window produces false silence, not false noise.
window produces false silence, not false noise. `hubble_ring_buffer` alone is
never grounds for `incomplete`: it is a read counter.
### Follow-up 2026-11-27: the gate as first written paged on reads
The first version of these rules recorded
`increase(hubble_lost_events_total{source="hubble_ring_buffer"}[30m])` and alerted
at `> 0`. That reproduced the artefact the deeper ring was meant to remove and
paged on it: measured at 18:39Z, `HubbleFlowWindowIncomplete` was firing on all
three nodes with `hubble:lost_events_increase_30m` ≈ 2.01, while
`perf_event_ring_buffer` and `observer_events_queue` were 0 everywhere and the
ring-buffer counter stepped +1 twice in an hour (18:27, 18:35 — identical
timestamps on all three nodes) with the Hubble UI open from the admin laptop. A
`for: 10m` cannot fix that: two status reads an hour keep `increase() > 0` true
for the whole hour, and the same recorder fed `HubbleFlowLossMaterial`, where a
couple of extra counts out of ~7 k flows on the quiet Pi node is 0.03 %.
Split applied: the gate recorder now covers `perf_event_ring_buffer` +
`observer_events_queue` only, `HubbleFlowWindowIncomplete` and
`HubbleFlowLossMaterial` read that (unchanged thresholds), and
`hubble_ring_buffer` gets rate-based `HubbleRingBufferReadChurn` at **0.05
events/s over 15 m** — ~45 reads per window, versus the F10 probe storm's
~0.2/s (12/min) and the current ~0.001/s (2 reads/hour). Both firing conditions
name the source in the summary so a read is never described as a dropped flow.
`hubble.eventBufferCapacity` was not touched and the agents were not rolled.
## Verification (live, 2026-11-27)