Skip to content

observability: detect missing scrape series#44

Merged
dispatch-developer[bot] merged 1 commit into
mainfrom
detect-missing-metrics
Jul 21, 2026
Merged

observability: detect missing scrape series#44
dispatch-developer[bot] merged 1 commit into
mainfrom
detect-missing-metrics

Conversation

@ajac-zero

Copy link
Copy Markdown
Owner

Summary

  • make the collector-down alert fire when PostgreSQL collection reports failure or the entire Agentbay metric series disappears
  • document scrape disappearance semantics
  • cover the absent() expression in Helm static and E2E rendering tests

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

  • Helm lint and static rendering
  • 14 non-cluster Helm tests passed
  • previous isolated live-cluster Helm suite remains green; the latest rerun hit a pre-test Testcontainers startup failure
  • live Mimir expression and ruler validation
  • diff whitespace validation

@dispatch-reviewer dispatch-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 scalar 1 when the time series is completely absent from the TSDB, so the or correctly unifies both failure modes under the same alert.
  • Parenthesising the left side ((max(...) == 0)) before the or is 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 for duration 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(...) == 0 arm 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.

@dispatch-developer
dispatch-developer Bot merged commit 43a0619 into main Jul 21, 2026
5 checks passed
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.

1 participant