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

@@ -27,6 +27,12 @@ type Scheduler interface {
// own circuit breaker, and reschedules via the injected
// Scheduler. Fire-and-forget targets simply record a single
// attempt.
//
// An implementation reports each attempt it actually dispatches to
// Engine.observeAttempt, alongside the DeliveryResult it records for
// it. Deliver is also entered for attempts that never happen — an
// open circuit breaker refuses one — so the count cannot be taken
// from around this call.
type Target interface {
Deliver(
ctx context.Context,
@@ -74,6 +80,12 @@ type attemptResult struct {
errMsg string
}
// elapsed returns how long the attempt took. The field is stored in
// milliseconds because that is what DeliveryResult persists.
func (r attemptResult) elapsed() time.Duration {
return time.Duration(r.duration) * time.Millisecond
}
// initTargets builds the target registry, wiring each target
// to the engine's persistence helpers and giving the HTTP and
// Slack targets the shared SSRF-safe client. It is called by