You inherit SLO recording rules where the 30-day availability is `avg_over_time(sli_ratio_5m[30d])`. Is anything wrong?
AdvancedScenarioSLO Design & Error Budget Decisions
Answer
Situation read → Averaging 5-minute ratios gives each window equal weight regardless of traffic: it is a time-based SLI disguised as a request-based one. Night-time outages and peak outages count the same.
What I'd do →
- Replace it with a ratio of sums over the window:
sum(increase(http_requests_total{job="checkout",code=~"5.."}[30d])) / sum(increase(http_requests_total{job="checkout"}[30d])) - Put it in a rule group with a 5-minute interval to keep the cost down.
- Compare old and new values for the last month and explain the difference to stakeholders.
- Generate future rules with Sloth or Pyrra to avoid hand-written mistakes.
Why → The SLI must match the SLO definition; a request-based SLO needs request-weighted math.
Interview tip → Explaining why averages of ratios are wrong is a strong senior signal.
More on SLO Design & Error Budget Decisions
Your manager asks you to "set up SLOs" for a checkout API that has none. Where do you start?BeginnerProduct insists on a 99.99% SLO for a service that has run at 99.7% for the last quarter. What do you do?IntermediateThe error budget for the month is exhausted on day 12, and a big feature launch is planned for day 15. What happens?IntermediateYou have one SLO for the whole API, and it's green, but the mobile team says login is broken for 10% of users.IntermediateYour service's latency SLO is "99% of requests under 500 ms", measured at the app. Users still complain about slowness.IntermediateA team wants to exclude all 5xx responses caused by a third-party payment provider from their SLO. Do you agree?Advanced