Skip to main content

Module alerts

Module alerts 

Source
Expand description

Opt-in operational webhook alerts.

A supervised loop polls runtime health every alerts.interval_secs and POSTs a JSON alert to the configured webhook when a condition trips: scheduler DLQ growth, provider down, token-budget exhaustion, or a supervised-loop restart storm. Threshold/dedupe decisions live in pure functions over snapshots so they are testable without a runtime; every delivery attempt is recorded in the tamper-evident audit chain (kind = "alert").

Structs§

Alert
AlertLoopState
Mutable state carried between polls: the previous sample (deltas) and per-class last-sent times (cooldown).
HealthSample
One poll’s worth of health numbers, gathered from the shared sources.

Functions§

budget_refusal_count
evaluate_alerts
Pure alert policy: compare the current sample against the previous one and the per-class cooldowns. The first poll only establishes a baseline.
note_budget_refusal
run_alerts_once
One poll: gather, evaluate, deliver. Extracted from the loop for testability; returns how many alerts were delivered (or attempted).
spawn_alerts
Spawn the supervised alerts loop; a no-op unless alerts are enabled with a webhook configured.