feat: Prometheus checks #78

Merged
Sebi merged 2 commits from feat/prometheus into main 2026-11-22 11:12:59 +00:00
Owner

Stacked on #76.

  • New check type prometheus: target is the Prometheus base URL (Thanos, Mimir, VictoriaMetrics work too), GET /api/v1/query with the PromQL query, optional headers (e.g. Authorization) and TLS verification.
  • Condition: == != > >= < <= against a threshold; mode all (default, every series) or any. Instant vectors and scalars; range vectors are refused with a hint. No data fails unless empty_ok.
  • Messages name the failing series in Prometheus notation: up{instance="b:9100",job="api"} = 0, expected == 1 (2 of 2 series fail); API errors are passed on (query failed: bad_data: parse error).
  • Console form with query, operator, threshold, mode, no-data option and headers; header values hidden from readers as for HTTP/JSON.
  • Tests: fake Prometheus covering vectors, scalars, empty and matrix results, API errors, validation; end-to-end with a checker opening an incident.

Closes #25

🤖 Generated with Claude Code

https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3

Stacked on #76. - New check type `prometheus`: target is the Prometheus base URL (Thanos, Mimir, VictoriaMetrics work too), `GET /api/v1/query` with the PromQL query, optional headers (e.g. Authorization) and TLS verification. - Condition: `== != > >= < <=` against a threshold; mode `all` (default, every series) or `any`. Instant vectors and scalars; range vectors are refused with a hint. No data fails unless `empty_ok`. - Messages name the failing series in Prometheus notation: `up{instance="b:9100",job="api"} = 0, expected == 1 (2 of 2 series fail)`; API errors are passed on (`query failed: bad_data: parse error`). - Console form with query, operator, threshold, mode, no-data option and headers; header values hidden from readers as for HTTP/JSON. - Tests: fake Prometheus covering vectors, scalars, empty and matrix results, API errors, validation; end-to-end with a checker opening an incident. Closes #25 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi added this to the M8 External Sources milestone 2026-11-22 10:49:17 +00:00
Sebi changed target branch from feat/json-check to main 2026-11-22 11:11:26 +00:00
Sebi added 7 commits 2026-11-22 11:11:26 +00:00
Refs #27

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
A heartbeat monitor has a secret ping URL instead of a target and
regions. Jobs call it with GET, HEAD or POST after each run, or /fail
with an optional message. When no ping arrives within the interval plus
a grace period, a failure is recorded and evaluated like a checker
result, so confirmations, maintenance and notifications apply. One API
replica at a time checks deadlines. The URL is shown only to members who
may edit the monitor, since it can report the job healthy.

Closes #27

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
The serializer checked the disabled property, which only reflects a
field's own attribute, so settings of other monitor types were sent too
and fields with the same name overwrote each other. Forms also gain
arrays from numbered names and header lines. Browser tests now run every
page in testdata, with a time limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
A JSON check requests a URL with GET or POST, optional headers and body,
and requires the expected status and every condition: paths like
checks[0].state compared with ==, !=, <, <=, >, >=, contains, exists or
absent. Failures name the path, the value found and the expectation.
HTTP and JSON checks share the request code and its network guard.

Refs #26

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Readers no longer see request header values, which typically hold
credentials.

Closes #26

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
A Prometheus check runs an instant query against the query API of
Prometheus or a compatible server and requires every series, or at least
one, to meet the condition. No data fails unless allowed. Failures name
the series, its value and the expectation; query errors are passed on.

Refs #25

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Closes #25

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi merged commit 624b5f28f2 into main 2026-11-22 11:12:59 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ZB-Server/uptimesebi#78