- 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)
This commit is contained in:
@@ -15,9 +15,10 @@ pub struct Stats {
|
||||
pub mut:
|
||||
total_notifications int
|
||||
errors int
|
||||
http_polls int // v0.5: total HTTP poll checks
|
||||
by_source map[string]int
|
||||
start_time time.Time
|
||||
}
|
||||
|
||||
pub struct App {
|
||||
pub mut:
|
||||
cfg Config
|
||||
@@ -190,6 +191,9 @@ pub fn (mut app App) handle(req http.Request) http.Response {
|
||||
if req.url == '/api/silence' {
|
||||
return app.silence_status_response()
|
||||
}
|
||||
if req.url == '/metrics' {
|
||||
return app.metrics_response()
|
||||
}
|
||||
}
|
||||
.post {
|
||||
if req.url.starts_with('/api/silence') {
|
||||
@@ -409,6 +413,7 @@ fn (mut app App) http_poll_loop() {
|
||||
}
|
||||
for src in app.cfg.sources.http_poll {
|
||||
for check in src.checks {
|
||||
app.stats.http_polls++
|
||||
app.run_http_check(check)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user