Next

Decide when error budget burn warrants a freeze

Agent buildEasy10 minGoogle style

Your task

An agent watches each service's error budget burn rate: how fast the service is spending its allowed errors, where 1 means exactly on budget. A short window catches spikes and a long window catches sustained burn, and the agent must not cry wolf on one noisy reading.

Write burn_rate_decision(samples, fast_window, slow_window, fast_threshold, slow_threshold): the rule your agent follows on each check.

  • samples (list of float): burn-rate readings, oldest first, newest last.
  • fast_window, slow_window (int): how many of the newest readings each window averages.
  • fast_threshold, slow_threshold (float): the average each window must reach to count as hot.
  • Return "recommend_freeze", "page_owner", "no_action" or "insufficient_data".

Rules, in order:

  1. If either window is below 1, or slow_window is smaller than fast_window: "insufficient_data".
  2. If there are fewer readings than slow_window: "insufficient_data".
  3. Average the last fast_window readings and the last slow_window readings. A window is hot when its average is at least its threshold.
  4. Both windows hot: "recommend_freeze".
  5. Only the fast window hot: "page_owner".
  6. Otherwise, including a hot slow window with a cool fast one: "no_action".

Then, in a sentence or two: should the agent freeze releases on its own, or only recommend a freeze? Take a side.

Examples

burn_rate_decision(samples: list[float], fast_window: int, slow_window: int, fast_threshold: float, slow_threshold: float) -> str
Example 1
Inputburn_rate_decision([6, 8, 10, 12, 14, 16], 2, 6, 6, 3)
Output"recommend_freeze"
Example 2
Inputburn_rate_decision([0.5, 0.5, 0.5, 0.5, 9, 11], 2, 6, 6, 3)
Output"recommend_freeze"
Example 3
Inputburn_rate_decision([0.5, 0.75, 0.5, 1, 0.5, 0.25], 2, 6, 6, 3)
Output"no_action"