PythiloLesson 10 of 12 · progress kept in this browser

Calculate burn against a defined service objective

An SLO defines which user events count as good and the acceptable fraction over a window. Error budget is the permitted bad fraction, while burn rate compares the observed bad fraction to that allowance. A raw failure count has no meaning without its denominator and window.

This exercise calculates a window summary, including a defined result for no traffic. A complete alerting policy would combine short and long windows and avoid treating a single tiny sample as decisive. The same computation can drive a release gate, but selecting the objective is a product and operational decision rather than an automatic metric choice.

good,total=990,1000
objective=.999
bad_rate=1-good/total
print(round(bad_rate/(1-objective),3))
Your task

Implement slo_window(good,total,objective). Require integers 0<=good<=total, total>=0 and 0<objective<1. Return dict availability and burn; for zero traffic return None for both.