How do you use SLOs to decide whether a deploy should be rolled back automatically?
AdvancedScenarioSLOs and Error Budgets
Answer
Situation read → Progressive delivery can use the SLI as its health signal.
What I'd do →
- Use Argo Rollouts or Flagger with canary steps (5%, 25%, 50%).
- Define an
AnalysisTemplatequerying Prometheus for the canary's error ratio and latency SLI. - Fail the analysis if the canary burns budget faster than baseline (e.g. error ratio > 1% for 2 consecutive checks).
- Automatic rollback on failure; notify the team.
metrics:
- name: error-ratio
interval: 1m
failureLimit: 2
successCondition: result[0] < 0.01
provider:
prometheus:
address: http://prometheus.monitoring:9090
query: sum(rate(http_requests_total{app="api",track="canary",code=~"5.."}[2m])) / sum(rate(http_requests_total{app="api",track="canary"}[2m]))
Why → Bad deploys are caught on a fraction of traffic before they burn the full budget.
Interview tip → Compare canary to baseline, not to a fixed number, when traffic varies.
More on SLOs and Error Budgets
Your company has no SLOs. A VP asks you to introduce them. Where do you begin?BeginnerChoose an SLI for a REST API: availability measured at the pod, the load balancer, or the client?IntermediateThe product owner wants a 99.99% SLO for a service that depends on a database with 99.95% availability. What do you say?IntermediateThe error budget for the month is exhausted on day 18. What happens now?IntermediateWrite an SLO in a declarative tool so teams do not hand-write burn-rate rules.AdvancedLatency SLO: "99% of requests under 300 ms." How do you measure it correctly in Prometheus?Intermediate