You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(stovepipe): report the last-green change timestamp from record (#583)
## Summary
- Record now emits the creation time of the change the last-green
bookmark points at as a `record.last_green_timestamp_seconds` gauge
(Unix seconds, tagged by queue), written after the bookmark update is
durable. Subtracting it from the current time gives how old the change a
queue considers green is.
- Adds `SourceControl.ChangeInfo(ctx, uri)` for immutable change
metadata (`CreatedAt` as an int64 millisecond timestamp, matching the
rest of the repo) plus the fake implementation, and a
`metrics.NamedGauge` helper.
- Reporting is best-effort: an unresolvable queue, a failed lookup, and
a missing timestamp are each counted and logged separately rather than
returned, so an observability failure cannot turn a successful record
operation into a retry.
## Caveat worth reviewing
A tally gauge is reported once per `Update`, not continuously, so this
series is sparse by construction: it has a datapoint only when the
bookmark advances, and carries no value between advances or after a
restart. Queries must aggregate across replicas with `max`/last-value.
That means it cannot alert on a queue that *stops* going green — the
existing `record.last_green_advanced` counter is the signal for that.
The `platform/metrics` README now states this so the next caller of
`NamedGauge` sees it. If we want a continuously readable value, the
follow-up is a periodic per-queue reporter over `queueconfig.Store.List`
+ `QueueStore.Get`.
## Test plan
- [x] `go build ./...`
- [x] `go test ./stovepipe/... ./platform/metrics/...`
- [x] `make gazelle` produces no BUILD changes; `gofmt -l` clean
- [ ] CI `required-checks` gate
- Note: `make mocks` fails at HEAD independently of this branch —
mockgen's source mode cannot parse `History`'s generic
`page.Page[string]` return, so `sourcecontrol_mock.go` cannot be
regenerated locally.
@@ -57,7 +58,9 @@ h := metrics.NamedHistogram(c.scope, "process", "duration", metrics.FastLatencyB
57
58
h.RecordDuration(elapsed)
58
59
```
59
60
60
-
Do not emit gauges or timers. Represent operation latency and completion count with lifecycle histograms, and represent instantaneous quantities as sampled histogram values when needed.
61
+
Use gauges only for state whose latest value is the whole answer, such as a bookmark timestamp. A gauge is reported once per update rather than continuously, so a gauge set on a discrete event produces a sparse series: it carries no value between updates or after a restart, and each replica reports only the updates it made, so queries must aggregate across replicas with `max` or last-value. State that must be readable at any moment needs a periodic re-emit rather than an event-driven one.
62
+
63
+
Represent operation latency and completion count with lifecycle histograms; do not emit timers.
0 commit comments