webhooker_delivery_duration_seconds is absent from a scrape until the first delivery occurs #267

Closed
opened 2026-08-24 02:00:12 +02:00 by clawbot · 2 comments
Collaborator

Confirmed by execution during the review of #264: on a freshly started instance that has delivered nothing, webhooker_delivery_duration_seconds does not appear in /metrics at all (grep count 0).

initSeries in internal/metrics/metrics.go materialises every delivery counter and gauge at zero, but not deliveryDuration. The other eight webhooker_* delivery series are present from boot; this one is not.

Why it matters rather than being merely tidy: #209 exists so an operator can alert on delivery health. On a dashboard or in an alert rule, an absent series is indistinguishable from a broken exporter or a misspelled metric name — the operator cannot tell "nothing has been delivered yet" from "my monitoring is wrong". Materialising it at zero removes that ambiguity, which is the same reasoning that put the other eight in initSeries.

Narrow, and only observable before the first delivery, which is why it is not milestoned.

Definition of done:

  • deliveryDuration is materialised in initSeries for the same target-type label set the other delivery series use, so it appears from boot.
  • A test asserting webhooker_delivery_duration_seconds is present in a scrape from an instance that has delivered nothing.
  • If materialising a histogram at zero is judged wrong (a histogram with no observations is arguably not meaningful), close this with that reasoning recorded instead — but make the decision explicitly rather than leaving the inconsistency unexplained.
Confirmed by execution during the review of https://git.eeqj.de/sneak/webhooker/pulls/264: on a freshly started instance that has delivered nothing, `webhooker_delivery_duration_seconds` does not appear in `/metrics` at all (grep count 0). `initSeries` in `internal/metrics/metrics.go` materialises every delivery counter and gauge at zero, but not `deliveryDuration`. The other eight `webhooker_*` delivery series are present from boot; this one is not. Why it matters rather than being merely tidy: https://git.eeqj.de/sneak/webhooker/issues/209 exists so an operator can alert on delivery health. On a dashboard or in an alert rule, an absent series is indistinguishable from a broken exporter or a misspelled metric name — the operator cannot tell "nothing has been delivered yet" from "my monitoring is wrong". Materialising it at zero removes that ambiguity, which is the same reasoning that put the other eight in `initSeries`. Narrow, and only observable before the first delivery, which is why it is not milestoned. Definition of done: - `deliveryDuration` is materialised in `initSeries` for the same target-type label set the other delivery series use, so it appears from boot. - A test asserting `webhooker_delivery_duration_seconds` is present in a scrape from an instance that has delivered nothing. - If materialising a histogram at zero is judged wrong (a histogram with no observations is arguably not meaningful), close this with that reasoning recorded instead — but make the decision explicitly rather than leaving the inconsistency unexplained.
clawbot added this to the 1.0.0 milestone 2026-09-21 09:20:33 +02:00
Author
Collaborator

Plan. The issue body is the brief, on top of #227's registry, now on next. initSeries also materialises deliveryDuration for the same target-type labels as the other delivery series, so webhooker_delivery_duration_seconds appears from boot with a zero count; a Prometheus histogram with no observations reports zero count and sum, which an alert rule can tell apart from an absent series. A test scrapes an instance that has delivered nothing and finds the series.

Model: opus-5-5

Plan. The issue body is the brief, on top of https://git.eeqj.de/sneak/webhooker/issues/227's registry, now on `next`. `initSeries` also materialises `deliveryDuration` for the same target-type labels as the other delivery series, so `webhooker_delivery_duration_seconds` appears from boot with a zero count; a Prometheus histogram with no observations reports zero count and sum, which an alert rule can tell apart from an absent series. A test scrapes an instance that has delivered nothing and finds the series. Model: opus-5-5
Author
Collaborator

Built in #427: initSeries now creates webhooker_delivery_duration_seconds for the same four target types as the other delivery series, so /metrics serves it with a zero count and sum from boot. The registration test lists it with the other series, and a new route test scrapes /metrics on a fresh instance that has delivered nothing and finds it for every target type.

Judgement call: materialised rather than closed, since a histogram with zero observations can be told apart from an absent series.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/webhooker/pulls/427: `initSeries` now creates `webhooker_delivery_duration_seconds` for the same four target types as the other delivery series, so `/metrics` serves it with a zero count and sum from boot. The registration test lists it with the other series, and a new route test scrapes `/metrics` on a fresh instance that has delivered nothing and finds it for every target type. Judgement call: materialised rather than closed, since a histogram with zero observations can be told apart from an absent series. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#267