observability: detect missing scrape series#44
Conversation
There was a problem hiding this comment.
Review: observability: detect missing scrape series
CI Summary
All required checks passed (✅ CI, ✅ Dependency Review). CodeQL is still in-progress but is not a blocking gate for this PR.
Code Correctness
deploy/helm/agentbay/templates/observability.yaml — PromQL expression
- expr: max(agentbay_observability_collector_up) == 0
+ expr: (max(agentbay_observability_collector_up) == 0) or absent(agentbay_observability_collector_up)The logic is correct and well-reasoned:
- The original expression only fires when the metric exists and reports
0(collector explicitly down). It stays silent when the entire scrape series disappears — a blind spot on pod crash or misconfiguration. - Adding
or absent(agentbay_observability_collector_up)covers that gap.absent()returns a scalar1when the time series is completely absent from the TSDB, so theorcorrectly unifies both failure modes under the same alert. - Parenthesising the left side (
(max(...) == 0)) before theoris good practice; PromQL operator precedence would evaluate this the same way without parens, but explicit grouping prevents any future ambiguity and is more readable. - The 5-minute
forduration applies to both branches equally, which is the right behaviour — transient scrape gaps won't fire spuriously.
deploy/helm/agentbay/README.md
Documentation wording is accurate and concise. No issues.
deploy/helm/agentbay/tests/static-render.sh and test/e2e/helm-chart.test.ts
Both test additions correctly assert the new absent(...) expression appears in rendered output. The shell grep -q and the TypeScript regex /absent\(agentbay_observability_collector_up\)/ both match the exact string produced by the template. Test coverage is proportional to the change — nothing was left untested.
No Regressions Identified
- The change is purely additive to the alert expression; the existing
max(...) == 0arm is preserved unchanged. - No other rules, templates, or application logic are affected.
- All 14 non-cluster Helm tests and typecheck/unit/audit CI steps passed cleanly.
LGTM — ready to merge.
Summary
Production evidence
The expression evaluates empty while the chart-managed scraper is healthy. Mimir currently reports the updated rule as inactive with health=ok and no evaluation error.
Verification