get_*
Solid hand: high-water mark (HWM). Dashed hand: wall clock. During a lull the clock moves on while the HWM stays put. Slots fade with age going clockwise from the hand; 91 = 900 s / 10 s + 1.
get_completed_volume()Reads land at random moments. On each read, the blue sweep walks over the slots that get summed.
get_top_failed_accounts()| Time | Returned (MGA) | Exact (MGA) | Difference | Top 3 returned | Verdict |
|---|
The window floor falls inside the oldest bucket, which is read whole. The volume can overshoot the exact figure by up to 9 s of events and never undershoots. In the irregular run, 25 of 41 reads show it (amber), and on 3 of them the top 3 differs from the exact top 3. Document it as "900 s, to the nearest 10 s".
sorted() keys on the failure count alone. With equal counts, the order depends on where accounts sit in the ring. Sorting on (-count, account_id) makes it stable.
In a lull the HWM hand stops while the dashed clock hand keeps moving. KPIs describe the last burst until a new event arrives. That matches the brief.
A timestamp far in the future empties every KPI, and a missing key raises KeyError.