Video in progress
What signals do you build the automatic "promote or roll back" decision for a canary deploy on?
I statistically compare the SLIs of the canary and a baseline (the old version, with the same share of traffic): error ratio, latency distribution, saturation metrics. I base the decision not on an absolute threshold but on the relative difference, and only after enough traffic has accumulated. Business signals (conversion, payment success) count too.
📖 Answer
Comparing the canary to the rest of prod is a mistake: the old pods have been warm for hours with full caches, while the canary just started. So you compare the canary against a baseline that was started at the same time (the old version, the same size as the canary).
Layers of signals:
- Hard stoppers: a crash loop, readiness never passing, a 5xx ratio clearly above the baseline. These mean immediate rollback.
- SLI comparison: error ratio, p50/p95/p99 latency, downstream call errors. A statistical test like Mann-Whitney or, more simply, "canary p99 is no more than 20% worse than baseline, with at least N requests".
- Resource signals: CPU per request, heap after GC, GC time, Hikari pending. A memory leak doesn't show up in latency in the first hour, but it does show up in the heap trend.
- Business signals: payment success, add-to-cart ratio. A version that is technically "green" may have hidden the button.
In Argo Rollouts this is done with an AnalysisTemplate:
metrics:
- name: error-rate
interval: 2m
count: 5
failureLimit: 1
successCondition: result[0] <= 0.01
provider:
prometheus:
query: |
sum(rate(http_server_requests_seconds_count{version="{{args.canary}}",status=~"5.."}[2m]))
/ sum(rate(http_server_requests_seconds_count{version="{{args.canary}}"}[2m]))
Subtle points:
- Enough traffic: on a low-traffic service, a 5% canary gets 30 requests in 10 minutes, and you can't draw a statistical conclusion. There the canary stays longer or synthetic traffic is added.
- Problems that show up late: a cron job that runs at night, cache expiry, all outside the canary window. That is why a "bake time" and an automatic rollback rule remain even after the full rollout.
- Metrics must have a version tag: without it you can't tell the canary and baseline apart, and this is the most often forgotten preparation.
Sign up to mark studied questions and save your progress.