feat(check): compare PromQL query results with a threshold

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
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 11:49:07 +01:00
1 parent 1ee1bc83c2
commit 5e7db9c054
3 files changed
+306 -3

No files matched your search

+6 -3
View File
@@ -24,13 +24,15 @@ const (
TLS Type = "tls"
// JSON checks an HTTP API's JSON response against assertions.
JSON Type = "json"
// Prometheus compares the result of a PromQL query with a threshold.
Prometheus Type = "prometheus"
// Heartbeat monitors are pinged by the monitored job; no checker runs
// them.
Heartbeat Type = "heartbeat"
)
// Types lists every check type.
var Types = []Type{HTTP, TCP, ICMP, DNS, TLS, JSON, Heartbeat}
var Types = []Type{HTTP, TCP, ICMP, DNS, TLS, JSON, Prometheus, Heartbeat}
// Passive reports whether t is reported to us rather than run by checkers.
func Passive(t Type) bool { return t == Heartbeat }
@@ -86,8 +88,9 @@ var impls = map[Type]impl{
DNS: dnsCheck{},
TLS: tlsCheck{},
JSON: jsonCheck{},
Heartbeat: heartbeatCheck{},
JSON: jsonCheck{},
Prometheus: prometheusCheck{},
Heartbeat: heartbeatCheck{},
}
// Validate checks target and config for type t and returns the normalized