feat(prometheus): Fabled Archives template v2 against the live series; a state past its deadline is overdue (#5693)
Read from what Steward stored for Archives on 2026-10-14: the nightly Restic replication job had said "running" since the first scrape two days earlier, with no good copy yet and past both its late and missing times. Archives ranks "running" above lateness, so the widget called it healthy. - states blocks take warn_past / crit_past: a deadline metric per row (a *_timestamp_seconds). Once it has passed, a healthy row reads as a warning or a problem: "FullNightly-Restic is running, 11h 53m overdue". Quiet and already-failing rows keep their own reading. - The Archives template (version 2) uses the job's late_at / missing_at deadlines and shows its last good copy beside the next run. It says why section_up, the queue and the HTTP/audit counters are left out. - tests/plugins/prometheus/archives_live.py is the series as captured live, and test_archives_template.py renders the template over them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -284,7 +284,8 @@ class _Check:
|
||||
|
||||
# Each block: the keys it takes, those it needs, and its title when none is given.
|
||||
_BLOCKS = {
|
||||
"states": (("title", "metric", "where", "name", "healthy", "quiet", "warning", "columns"),
|
||||
"states": (("title", "metric", "where", "name", "healthy", "quiet", "warning", "warn_past",
|
||||
"crit_past", "columns"),
|
||||
("metric", "healthy"), "States"),
|
||||
"values": (("title", "items"), ("items",), "Figures"),
|
||||
"times": (("title", "items"), ("items",), "Times"),
|
||||
@@ -301,7 +302,12 @@ _COLUMN = ("label", "metric", "unit")
|
||||
def _states(c: _Check, m: _Map, ctx: str) -> dict:
|
||||
spec = {"metric": c.metric(m, "metric", ctx), "where": c.where(m, ctx), "name": c.label(m, "name", ctx),
|
||||
"healthy": c.words(m, "healthy", ctx), "quiet": c.words(m, "quiet", ctx),
|
||||
"warning": c.words(m, "warning", ctx), "columns": []}
|
||||
"warning": c.words(m, "warning", ctx), "columns": [],
|
||||
# A deadline per row (a *_timestamp_seconds): once it has passed, a
|
||||
# healthy row reads as a warning or a problem. A job that says
|
||||
# "running" for days is still overdue.
|
||||
"warn_past": c.metric(m, "warn_past", ctx) if "warn_past" in m else "",
|
||||
"crit_past": c.metric(m, "crit_past", ctx) if "crit_past" in m else ""}
|
||||
if "healthy" in m and not spec["healthy"] and isinstance(m["healthy"], list):
|
||||
c.add(m.lines["healthy"], f"`healthy` in {ctx} needs at least one state.")
|
||||
seen: dict[str, str] = {}
|
||||
|
||||
Reference in New Issue
Block a user