Signals
Error budget left
Report how many additional failed requests fit into a request-based error budget.
In production
Error budget is how much failure SLO still allows. Clamping or floating drift changes whether a release may ship.
What it must return
Compute remaining budget in integers from total, failures, and slo_bps. Negative remainders are valid evidence.
- total and failures are nonnegative integers; failures <= total. slo_bps is 0–10000 basis points. Allowed failures = floor(total*(10000-slo_bps)/10000). Return allowed minus failures, including negative values.
- Do not mutate input values. Use the Python standard library only.
Edge cases
- Keep arithmetic in integers.
- Do not clamp a negative budget to zero.
- Basis points mean / 10000, not / 100.
Signature
remaining_budget(total, failures, slo_bps)Hints
Second hint
A partial sketch
The reference solution opens after the last hint.
Loading editor…
Budget remains
total
10000
failures
5
slo_bps
9990
Expected
5
Each run uses a fresh Python runtime in this browser, with a 3-second limit and a Stop button. The first run downloads the runtime. 0 of 12 in Signals passed in Python on this device.