Show an Argo Rollouts canary with a Prometheus analysis.
AdvancedConceptRelease Engineering & Reliability Patterns
Answer
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata: {name: checkout}
spec:
strategy:
canary:
steps:
- setWeight: 10
- analysis: {templates: [{templateName: success-rate}]}
- setWeight: 50
- pause: {duration: 10m}
---
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata: {name: success-rate}
spec:
metrics:
- name: success-rate
interval: 1m
count: 5
failureLimit: 1
successCondition: result[0] >= 0.999
provider:
prometheus:
address: http://prometheus.monitoring:9090
query: |
sum(rate(http_requests_total{job="checkout",code!~"5.."}[2m]))
/ sum(rate(http_requests_total{job="checkout"}[2m]))
The Rollout spec also needs selector and template like a Deployment. If the analysis fails, Argo Rollouts aborts and shifts traffic back to stable.
More on Release Engineering & Reliability Patterns
Why are releases the biggest source of incidents, and what does SRE do about it?BeginnerWhat is a canary release?BeginnerWhat is progressive delivery?IntermediateBlue-green vs canary: when do you choose each?IntermediateWhat are feature flags and how do they improve reliability?BeginnerWhat is a rollback vs a roll-forward, and when do you choose each?Intermediate