Skip to content

E2: Deeper healthcheck (report degraded on stalled collection) #42

Description

@LarsLaskowski

Epic: Cross-cutting / smaller items

Suggested extra label: ops.

Why

GET /healthz returns a static ok (server.go:76handleHealthz); it stays green even if the collector goroutine has stalled and the metrics are stale. systemd / uptime monitors cannot detect that failure mode.

Scope

Optionally report unhealthy (non-200) when the latest snapshot is older than a configurable staleness bound. The snapshot already carries a Timestamp (collector.go:138 Snapshot()), so freshness is now - Snapshot().Timestamp compared against a multiple of the fast poll interval.

Reuse & touch points

  • internal/httpapi/handlers.gohandleHealthz.
  • MetricsProvider already exposes Snapshot() (server.go:19).
  • Optional config healthz_max_staleness.

API & config impact

/healthz may now return non-200 (document this); keep it auth-exempt as today (handlers_test.go:160).

Acceptance criteria

  • A fake provider with a stale timestamp yields a non-200 response.
  • A fresh snapshot yields 200 ok.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions