Expose delivery metrics on /metrics (closes #209) (#224)
Some checks failed
check / check (push) Superseded by a newer commit; never tested

This commit was merged in pull request #224.
This commit is contained in:
2026-08-20 07:19:04 +02:00
parent a13e5b7ded
commit 4cc83b2326
16 changed files with 1650 additions and 18 deletions

View File

@@ -18,6 +18,7 @@ import (
"sneak.berlin/go/webhooker/internal/globals"
"sneak.berlin/go/webhooker/internal/healthcheck"
"sneak.berlin/go/webhooker/internal/logger"
"sneak.berlin/go/webhooker/internal/metrics"
"sneak.berlin/go/webhooker/internal/middleware"
"sneak.berlin/go/webhooker/internal/session"
"sneak.berlin/go/webhooker/templates"
@@ -73,6 +74,7 @@ type Handlers struct {
mw *middleware.Middleware
notifier delivery.Notifier
evictor delivery.WebhookEvictor
mtr *metrics.Set
templates map[string]*template.Template
// dummyVerifications counts the equivalent-cost verifications
@@ -114,6 +116,7 @@ func New(
s.mw = params.Middleware
s.notifier = params.Notifier
s.evictor = params.Evictor
s.mtr = metrics.Default()
// Parse all page templates once at startup
s.templates = map[string]*template.Template{

View File

@@ -217,6 +217,11 @@ func (h *Handlers) createAndDeliverEvent(
return
}
// Counted here, after the commit: an event is received once it
// is durably stored, which is what the delivery counters are
// compared against on a dashboard.
h.mtr.EventReceived()
h.finishWebhookResponse(w, event, entrypoint, tasks)
}