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
## Context
The served path delegates to the events store silently by design, so a lagging or broken
pipeline is indistinguishable from usage merely being slow, which is what usage looked like
before the buckets existed. Aggregation is the cost, so the size of the win equals coverage:
one delegated high-traffic charge keeps a subscription slow however well the rest of the plan
is served.
## Description
Every current usage lookup is now counted as served or delegated and tagged with the reason,
emitted from the event store provider, which is the only place that knows both the decision
and why it was taken. The reasons partition the declines, so a delegation rate can be
explained without reading the code, and the residue left after subtracting the ineligible
charges is the signal that something is wrong.
Alongside it, the freshness of the buckets behind a served read. It is the most recent bucket
write rather than the oldest: the oldest reports the age of the billing period, since a bucket
closed on day one is never rewritten. It cannot tell a stalled pipeline from a charge nobody
sends events for, so liveness stays with the pipeline's own loopback.
The reasons are deliberately coarse. One label per branch would mirror the code rather than
answer a question, and the cases worth separating are the ones an operator would act on
differently. A ClickHouse read that failed is not among them: it already reaches Sentry, so it
shares a label with the callers that decline the prefetch outright.
Metrics are emitted only for organizations the gate is on for, or the disabled buckets would
drown the ratio, and no metric carries an organization, subscription or charge id, so the
series count stays a function of the reason list rather than of the customer base.
The alert rules and the pipeline's own liveness loopback live outside this repository.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments