Argo Rollouts canary: a rollout that stops itself on metric analysis

Argo Rollouts canary: write a Prometheus AnalysisTemplate so the rollout stops by itself when the error rate crosses your threshold.
Argo Rollouts canary : un déploiement qui s'arrête seul sur analyse de métriques

It is 5:40 pm on a Friday and the new version is about to reach production. Nobody wants to stay behind to watch a graph. An Argo Rollouts canary driven by metrics solves that: the controller compares an indicator with a threshold itself, and stops the rollout when the new version misbehaves. This article starts from the operating decision behind it, “who judges the release: a person or a query?”, and shows how to write it in YAML.

The facts come from the official Argo Rollouts documentation (the “Analysis” and “Prometheus” pages), read on 13 November 2026. I did not deploy a cluster for this article: the examples are illustrative configurations that were not run. Anything unverified is flagged in the text.

This is about Argo Rollouts, a third-party tool, and Prometheus. No Dynatrace feature is presented here. For the GitOps side, read our Argo CD article first: it covers synchronisation, not traffic progression.

The problem: a canary that waits for a human

A classic canary sends 10% of traffic to the new version, then waits. Someone looks at the errors, decides, then resumes. That model has two flaws. It depends on one person’s attention, and the success criterion lives in their head.

Metric analysis moves that judgement into the repository. You write the rule once (“under 2% of 5xx errors”), it goes through code review, and the controller applies it to every release. That means less toil and a shorter MTTR, because the faulty version is cut before a customer tells you about it.

Argo Rollouts canary: the three objects to know

Three resources are enough to understand the mechanism:

  • the Rollout replaces the Deployment and carries the canary strategy (weights, pauses);
  • the AnalysisTemplate describes one or more measurements: provider, query, conditions;
  • the AnalysisRun is the concrete execution of a template, created by the controller during the rollout.

A variant exists: the ClusterAnalysisTemplate, usable from several namespaces. The documentation states that the AnalysisRun still runs in the Rollout’s namespace.

Writing the AnalysisTemplate with Prometheus

Take a simple rule: the share of 5xx responses over two minutes must stay under 2%. Here is the illustrative template.

AnalysisTemplate named taux-erreurs-5xx: measured every 2 minutes, condition result[0] below 0.02, prometheus provider with address, timeout and PromQL query

The fields that matter:

  1. interval sets the measurement pace. Without it, the documentation says you get a single measurement.
  2. initialDelay delays the first measurement of that metric, which helps while pods warm up.
  3. successCondition is an expression on result. Prometheus returns a vector, so you read result[0].
  4. failureLimit is the number of failed measurements tolerated. Here two failures are allowed and the third fails the metric. The value -1 disables this limit.
  5. args injects values through {{args.service}}, resolved when the AnalysisRun is created.

A metric with no condition gives an “Inconclusive” result, so do not forget one. Another limit: the page does not describe what happens when a query returns an empty result or NaN. With a 10% canary on low traffic, test that case in staging before you rely on it.

Attaching the analysis to the Rollout

There are two ways to wire the analysis in, and they behave differently.

Background analysis runs while the steps advance. It is declared under strategy.canary.analysis, with startingStep to start only from a given step.

Rollout excerpt: background analysis with startingStep 1 and the taux-erreurs-5xx template, then steps setWeight 10, pause 5 minutes, setWeight 50, pause 10 minutes

Inline analysis is a step in the steps list. It blocks progress until the run finishes. It is the right choice for a gate before widening traffic.

Rollout excerpt: setWeight 20 step, then an analysis step referencing the taux-erreurs-5xx template with clusterScope true, then setWeight 100

In the example above, clusterScope: true assumes the template exists as a ClusterAnalysisTemplate. Adapt the name and the Prometheus address to your environment.

What happens when the measurement fails

The run result decides what comes next. According to the documentation:

  • Successful: the rollout carries on;
  • Failed: the rollout is aborted;
  • Inconclusive: the rollout pauses at its current step and waits for a manual resume or abort.

When a background analysis fails, the controller aborts the rollout, sets the canary weight back to zero and marks the Rollout as Degraded. That is the “stops by itself” of the title: traffic returns to the stable version with no one involved.

The page also covers BlueGreen: a failure before promotion prevents the traffic switch, and a failure after promotion sends traffic back to the previous stable ReplicaSet. I do not detail that mode here. The “Error” status is not described on the analysis page I read.

Choosing the query: the indicator matters more than the syntax

An automatic canary is only as good as its query. Three pointers.

  1. Start from an SLI your team already tracks, such as error rate or p95 latency. The error budget calculation helps you set a threshold consistent with your SLO.
  2. Filter on the canary pods, not the whole service: otherwise 90% of healthy traffic dilutes the signal.
  3. Test the query in the Prometheus UI before pasting it into the template, as the documentation recommends.

To connect Prometheus itself to your clusters, see Prometheus and Dynatrace on Kubernetes. To validate PromQL rules in CI, promtool in the pipeline is a good companion.

Authentication and security of the Prometheus provider

The provider accepts a maximum delay (timeout), custom headers such as X-Scope-OrgID for a multi-tenant Prometheus, and an insecure option that skips TLS verification. Keep it at false outside a lab. On authentication, the page documents sigv4 for Amazon Managed Prometheus and OAuth2 client credentials. It does not describe a standalone “bearer token” option. Secrets are read through valueFrom.secretKeyRef, in the AnalysisRun’s namespace.

Best practices

  • Start with a single metric that is easy to explain to the on-call engineer.
  • Use initialDelay so you do not judge pods that are still starting.
  • Plan for minimum traffic: a 10% canary on a quiet service gives noisy measurements.
  • For range queries, the documentation asks you to test every value, for example with all(result, # < 1000), not only result[0].
  • Document in the runbook how to resume or abort a Rollout paused as “Inconclusive”.

Frequently asked questions

What is the difference between background and inline analysis?

Background analysis runs alongside the canary steps and can stop the rollout at any time. Inline analysis is a step that blocks what follows until the run completes.

What does Argo Rollouts do when the analysis is “Inconclusive”?

It pauses the rollout at its current step. A person must then resume or abort it. This happens notably when no condition is defined or none is met.

Do I need Prometheus to use analysis?

In principle no: Prometheus is one provider among others, and this article only verified that one. Check the documentation for the current list of providers.

Conclusion

An Argo Rollouts canary with analysis turns “someone is watching” into “a versioned rule decides”. Start with one indicator, test it outside production, and plan for the case where the measurement is empty. Sources: Argo Rollouts analysis documentation and Prometheus provider.

span.observer is an independent community blog, not affiliated with Dynatrace LLC or the Argo project. Brands mentioned belong to their owners. Tools change fast: check fields and options in the official documentation.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
VictoriaMetrics Prometheus : remplacer ou compléter ?

VictoriaMetrics Prometheus: replace or complement?

Related Posts