Skip to main content

Practice ยท 2 of 2

The error budget

Implement error_budget(slo_success_rate, total, failures, window_days=30): - allowed failures = total * (1 - slo); budget remaining = 1 - failures/allowed, floored at 0 (1.0 when allowed is 0 and there are no failures) - returns {'slo', 'actual' (measured success rate), 'budget_remaining', 'status'} - status: 'healthy' when remaining >= 0.5, 'burning' when 0 < remaining < 0.5, 'breached' at 0 (a real breach must NOT read as merely burning) This function is the SLO decision: healthy โ†’ ship features; burning โ†’ stabilize.

Difficulty: advanced

Back to lesson: Practice: Observability Drills