Files
ntfy-bridge/metrics_test.v
T
bruno 83778cfb0d
CI / test (push) Successful in 2m30s
feat: Prometheus /metrics endpoint — Phase 5 -> 6/8
- metrics.v: GET /metrics au format OpenMetrics (gauges + counters)
- server.v: route /metrics, Stats.http_polls counter, increment in poll loop
- metrics_test.v: test du endpoint metrics
- ROADMAP: Phase 5 6/8 (Prometheus done)
2026-08-03 18:03:26 -04:00

29 lines
763 B
V

module main
fn test_metrics_keys() {
mut app := App{
logger: new_logger(.info, false)
cfg: Config{
filters: FilterConfig{}
outgoing: OutgoingConfig{}
state: StateConfig{}
}
poll_state: map[string]bool{}
}
app.poll_state['http://example.com'] = true
app.poll_state['http://down.com'] = false
app.stats.total_notifications = 42
app.stats.errors = 3
app.stats.by_source['docker'] = 10
resp := app.metrics_response()
body := resp.body
assert body.contains('ntfy_bridge_uptime_seconds')
assert body.contains('ntfy_bridge_notifications_total 42')
assert body.contains('ntfy_bridge_errors_total 3')
assert body.contains('ntfy_bridge_silence_active')
assert body.contains('ntfy_bridge_http_polls_total')
assert body.contains('# EOF')
}