Backfilling metrics after a backend outage

On 3 July a Mimir-compatible destination returned 5xx for 48 minutes. No datapoints were lost. This is what the edge buffer did during those 48 minutes, and the two ordering rules that keep replay from making things worse.

The whole point of a buffered edge is this moment: a destination goes dark, and your graphs do not. On 3 July one customer’s destination endpoint started returning 503 on every write. It lasted 48 minutes. Their dashboards showed delayed data, never missing data. Here is the mechanism, because “we buffer” is easy to say and harder to get right.

What the edge did, minute by minute

The moment deliveries to that destination started failing, each POP did three things.

It kept accepting. Ingest and delivery are decoupled by design. A datapoint is written to the POP’s on-disk queue and acknowledged with 202 before any delivery is attempted. A failing destination does not make the front door stop opening. From the customer’s exporters, nothing changed — writes still returned 202.

It backed off, per destination. The delivery worker for that one destination went into exponential backoff with jitter, capped at 30 seconds. Crucially this is scoped to the destination: the same customer’s other destinations kept receiving data at full speed. One bad backend does not stall the others.

It watched the buffer fill. The queue has a bound — the plan’s retention window, four hours for this customer. We track time-to-full continuously. At 48 minutes we were nowhere near it, but if we had been approaching the limit, the next rule would have kicked in.

The two rules that make replay safe

Replaying a backlog is where naive buffering turns a small outage into a large one. Two rules prevent that.

Rule one: replay in order, and never faster than the destination can take. When the destination recovered, the obvious temptation is to flush the backlog as fast as possible. That is how you turn “backend recovered” into “backend immediately knocked over again by a thundering replay.” We replay at a rate we ramp up gently, watching the destination’s response times, and we deliver in timestamp order so the backend’s own ingestion stays monotonic. A backend that assumes mostly-ordered writes (many do) stays happy.

17:02  destination 503s begin        accept: ok   deliver: backoff
17:02–17:50  buffering               accept: ok   deliver: retry w/ jitter
17:50  destination recovers          replay ramp: 10% → 100% over ~4 min
17:54  backlog drained, caught up    accept: ok   deliver: ok

Rule two: exactly-once, via idempotency. Retries mean a batch can be sent more than once. Every batch carries a stable idempotency key derived from its content and source. The delivery path deduplicates on that key, so a batch that was sent but whose ack was lost does not get written twice. Without this, replay inflates counters and double-counts — which is arguably worse than a gap, because it is a gap you cannot see.

What we did not do

We did not drop the oldest data to make room, because we never filled the buffer. If we had, the plan’s policy decides: by default we apply backpressure to the source (the exporters see slower acks and queue on their side) rather than silently discarding what we already accepted. Dropping data we have already acknowledged is the one thing a buffer exists to avoid.

The takeaway

A buffer is not a feature you add; it is a set of decisions about ordering, rate and identity that you have to get right before the outage, because during the outage there is no time to think. The 48 minutes on 3 July were uneventful for the customer precisely because they were not uneventful for us — they were the exact scenario the whole design exists to absorb. You can read the incident note on the status page.