Testing Prometheus upgrades with promtool and a canary server

A repeatable test routine for each Prometheus upgrade: promtool checks, rule unit tests in CI, query comparison on a canary, and the point where rollback is no longer simple.

On this page

Testing Prometheus upgrades with promtool and a canary before production

A team moving Prometheus to a newer version needs a repeatable routine that shows, before cutover, that alerts still fire, dashboards still return the same answers and the configuration still loads. The routine has four parts: static checks with promtool, rule unit tests run in CI, a canary server that runs the new version against real scrapes, and a query comparison between the canary and the current server. Each part catches a different class of failure, so skipping one leaves a gap that production will find first.

Start by confirming the target release line. Prometheus starts a new minor release cycle every 6 weeks, and a minor release generally stops receiving bug fixes after those 6 weeks. Long-term support releases receive fixes for one year. The current LTS line is 3.13, supported until July 31, 2027, and LTS 3.5 reached end of life on July 31, 2026, so a team still on 3.5 is already past its support window. If you are on a 2.x server, the Prometheus 3 migration guide suggests optionally upgrading to v2.55 first and confirming it works before moving to v3. Treat that stepping stone as a separate test cycle with its own canary run, and record which version each cycle proves.

Before any traffic moves, run promtool check config, promtool check rules, promtool check web-config and promtool check service-discovery against the exact files the new version will load, and run promtool test rules with your unit test files in CI. Store the test results with the release ticket. On the canary, point a second Prometheus at the same targets, keep it on a separate storage path, and compare key queries, alert states and target health against production over a period you agree in advance. Confirm with your change owner which differences are acceptable, and confirm how long the canary must run. Because storage formats can change between versions, record the rollback limits as part of the plan: once the new server has written blocks, downgrading may not read them, so the rollback point is the moment before cutover.

Which release changes the test routine must catch

This table lists the release facts that change what your upgrade tests must cover, with the test action each one calls for. Read each row as a trigger: when your target line or release falls into that row, run the routine described in the action column before you move production. The breaking changes themselves are covered on the sibling upgrade pages.

Release factWhat it changes for testingAction needed
v2.55 stepping stoneThe Prometheus 3 migration guide suggests optionally moving to v2.55 first and confirming it works before moving to v3Run the full test routine on v2.55 before any v3 test, so that a failure can be traced to one step
Six-week minor release cycleA minor release generally stops receiving bug fixes six weeks after it begins, so a skipped test cycle can leave you on an unpatched lineRepeat the test routine on a fixed schedule, and treat each new minor release as a candidate for the canary
LTS line 3.13The current long-term support line receives bug fixes for one year, so test runs should target this line when you choose LTSRun the routine against 3.13 and confirm the support end date with the release cycle page before you commit
LTS patch v3.13.4Patch releases on the same line change behavior less than a minor move, but they still alter the running binaryRun promtool checks and canary query comparisons on the patch before rolling it to production
Latest release v3.15.0A newer minor release can change query results, scrape behavior and rule evaluation, which the current configuration may not expectTest against v3.15.0 on the canary and compare results with the version currently in production
Breaking changes on sibling pagesSpecific query, scrape and API changes differ by source and target versionUse the sibling upgrade pages to build test cases for those changes, rather than relying on this routine alone

What to prepare before the first test run

Before any promtool check or canary comparison, you need a complete picture of what the current server loads, a recoverable copy of its state, and a host that sees what production sees. These cards cover the inventory, backup, canary setup, comparison list, Alertmanager access and sign-off that connect every later step of the upgrade test.

Inventory every config and rule file

List each prometheus.yml, rule file, web configuration file and service discovery file the server reads, including files pulled in by include paths and files mounted from secrets or config management. Record the version currently running and the flags it starts with, such as --web.enable-admin-api and --web.enable-lifecycle. Promtool can only check what you hand it, so a missing file in the inventory becomes an untested file after the upgrade.

promtool reference

Back up the data directory first

Local storage is not clustered or replicated and should be managed like any other single-node database, so copy the TSDB data directory and the configuration before the first test run. Confirm the copy can be restored on a separate host and that the restored server starts and answers queries. Treat this backup as the only reliable rollback point once a newer server has written to storage.

Default retention
15 days
Prometheus storage docs

Build a canary host with the same scrape reach

Provision a canary server in the same network segment as production, with the same firewall rules, certificates, and credentials for the targets it scrapes. A canary that cannot reach a target produces gaps that look like upgrade regressions. Confirm the canary can read service discovery sources and exporters, and that it uses a separate data directory so it never writes into production storage.

List dashboards and alerts to compare

Export the Grafana dashboards, recording rules and alerting rules that depend on Prometheus, and mark the queries that drive paging or capacity decisions. These are the queries you will compare between the current server and the canary. Include a few expensive queries and any that use histograms or label matching, because those are where behavior changes are most likely.

Secure access to Alertmanager configuration

Obtain read access to the Alertmanager configuration, receiver definitions, routing tree, inhibition rules and silences, and confirm which Alertmanager instances Prometheus sends to. Prometheus should point at every Alertmanager instance, so the canary must list the same set. Without this access, you cannot confirm that a test alert reaches the same receivers as production.

Alertmanager docs

Name one owner for sign-off

Assign a named person who accepts or rejects the upgrade based on the test results, and agree in writing what counts as a pass. That owner should be able to approve the rollback plan, the backup restore and the production window. Without a named owner, differences found by promtool or the canary often stay open until the new version is already in production.

How each test layer catches a different failure

The promtool checks run without a live server and fail fast on problems that would stop Prometheus from loading its configuration. The check config subcommand validates the main configuration file, including referenced rule files and scrape settings. check rules validates alerting and recording rule files on their own, and check web-config validates the TLS and basic authentication file used by the web server. check service-discovery helps confirm that discovery settings resolve to the targets you expect. The reference is in the promtool command-line reference.

  • Syntax and schema errors: Renamed or removed configuration keys and malformed rule expressions are reported before the new binary starts.
  • Web config problems: A bad certificate path or an unhashed password in the web configuration file is caught without exposing the endpoint.
  • Discovery mismatches: check service-discovery can show whether a changed discovery block selects the targets you expect, which is useful after a version change to relabeling behavior.
  • What they cannot catch: A syntactically valid rule that returns different results, or a scrape job that works in the file but fails against real endpoints.
  • Scope limit: Static checks read files only, so they say nothing about query output, memory use or the real number of series.

Confirm that the promtool binary matches the target Prometheus version before you run these gates.

Upgrade test sequence with checks and rollback points

This sequence turns a Prometheus upgrade into a set of gated stages, so each change is validated against the same configuration, rules and targets before it reaches production. Each stage closes with a check that must pass before the next one starts.

  1. Pin the target version and record the baseline

    The engineer responsible for the upgrade names one exact target release in version control, such as a specific minor or LTS patch, and records the currently running version, its configuration, rule files and retention settings. Pinning prevents a test from running against one build while production receives another. The step is done when the target version, the baseline and the owner are written in the change record and the team agrees the test scope. Confirm the target against the Prometheus release cycle page and GitHub releases before pinning, because patch releases on a supported line can change between tests.

  2. Run promtool checks against the new binary in CI

    The CI pipeline downloads the pinned Prometheus binary and runs promtool check config, check rules, check web-config where TLS or basic authentication is used, and check service-discovery against the production configuration. These checks catch syntax errors, invalid rule expressions, and configuration keys that the new version rejects. The step closes when every check exits without errors on the pinned binary and the job output is attached to the change record. Any failure blocks the pipeline, and the change does not move forward until it is fixed or the target is changed.

  3. Run rule unit tests in CI

    The pipeline runs promtool test rules against every rule unit test file, passing the files in one invocation so the full suite runs together. The tests use synthetic input series to confirm that alerting and recording rules produce the expected results on the new version. The step is done when every test file passes, and a failing test is treated as a stop condition rather than something to accept and revisit later. Teams should keep these tests current as rules change, since a test suite that no longer covers a rule gives false confidence.

  4. Deploy the upgrade to a canary that scrapes the same targets

    The team starts a canary Prometheus on the pinned version with the production configuration, pointed at the same scrape targets and the same Alertmanager instances, and with its own storage directory. Alert notifications from the canary should be suppressed or routed to a test receiver so that duplicate pages do not reach on-call staff. Before the canary begins collecting, the team takes a backup or snapshot of the production data directory as a rollback point, since storage on the production server has not changed yet. The step is complete when the canary is running, scraping, and showing healthy target states.

  5. Compare queries and alert states over the agreed window

    Over the window agreed before the test began, the team runs the same PromQL queries against production and canary, compares the results for dashboards and alert expressions, and reviews alert state transitions in both servers. Differences in label names, histogram buckets, or regex behavior are logged with the query, the expected result, and the observed result. The step closes when every difference has been explained as acceptable or assigned a fix, and the team signs off in writing. Because Prometheus values reliability over precision, small differences in sampled values may be expected, so the team should decide in advance which differences matter.

  6. Confirm all checks pass before promotion

    The release owner reviews the CI output, unit test results, and comparison log together and confirms that every check has passed on the pinned version. Promotion is blocked if any promtool check, rule test, or comparison item remains open. The decision and its reviewers are recorded in the change record. The step is done when the record shows all gates passed and the approver has accepted the result.

  7. Promote with a rollback point before any storage change

    Before the production server is restarted on the new version, the team takes a fresh backup of the data directory and records the old binary and configuration so they can be restored. The team should note that a new version may change the on-disk storage format, and once that change has been written, returning to the older binary may not read the data, so the snapshot is the only reliable way back to the previous state. After the upgrade, the team confirms that targets are scraping, rules are evaluating, and Alertmanager is receiving alerts. The step is done when those checks pass and the rollback procedure has been documented for the next release.

How the canary and production servers share the same inputs

The diagram starts with the Git repository that holds configuration, rule files and unit tests, and shows the same reviewed files passing through promtool checks and rule tests in CI before either server loads them. The canary and production Prometheus servers then scrape the same targets, so query results can be compared side by side. A promotion decision follows that comparison. The marked point after the storage change is where rollback to the previous binary stops being a simple option, so confirm the exact behavior for your version before crossing it.

Shared inputs feed both servers, and the storage change marks where rollback ends.

Where rollback stops working once storage has changed

Rolling back a Prometheus binary is simple only until the new version writes data the old version cannot read, or until the storage layout changes. Prometheus keeps samples in a local time series database made of two-hour blocks, with a write-ahead log holding the most recent data before it is compacted into blocks. Once the new release has written blocks or changed how the write-ahead log is replayed, reinstalling the previous binary may start with a data directory it refuses to open or reads incorrectly. The canary test should therefore treat the storage directory as the thing that decides whether rollback is possible, not the binary.

Local storage is single-node and not clustered or replicated, so there is no second copy of the data to fall back on. Default retention is 15 days, which means that a bad upgrade discovered late can leave a full fortnight of history written in the new format. Before each production upgrade, stop the server cleanly and copy the data directory to separate storage, keeping the copy's permissions and free space in mind. Confirm in the release notes for the target version which earlier versions can read blocks it writes, and record that answer in the upgrade plan, because the answer decides whether a restore from the copy is the only rollback path.

Restoring from a pre-upgrade copy also rolls back the data window, so metrics collected during the failed attempt are lost unless they were forwarded elsewhere through remote write. Test the restore on the canary host itself, with the old binary and the copied directory, and time how long the server takes to come back to a state where dashboards and alert rules evaluate correctly. Write down who can approve a restore, which alerts will be silent while Prometheus is down, and how Alertmanager will be told. Ask your Prometheus support provider or your own platform team to confirm these steps in your environment before the upgrade window opens.

Questions teams ask before testing a Prometheus upgrade

How much effort does a Prometheus upgrade test routine take?

The effort depends mostly on how many configuration files, rule files, web config files and dashboards you have, and how many queries your alerts and dashboards depend on. Each of these adds work in three places: running the promtool checks, writing rule unit tests for alerts that matter, and building the query comparison on a canary. Teams with a small, well-documented setup usually spend far less time than teams whose rules were written over many years by several people. Your quote should break the work into these parts, state which parts are one-time (the test harness, the query inventory, the CI job) and which recur with every upgrade (rerunning checks, updating tests for changed behavior, repeating the comparison).

Can our own team run the upgrade test routine alone?

Often yes, if at least one engineer knows PromQL well, owns the alert rules and can run a second Prometheus server with the same scrape targets. promtool ships with Prometheus, and its check and test subcommands run in a CI job without special access. The harder part is judgment: deciding which query differences matter, and knowing which alerts page people. Teams that lack that knowledge, or that have no spare host for a canary, often bring in an outside team for the setup and let their own engineers own the decisions after handover. A written scope makes that split clear before work starts.

What does the upgrade test need from our team?

You need four things. First, read access to the current Prometheus configuration, rule files and web config, and a way to run promtool against them in CI. Second, a canary host with network access to the same targets and enough disk and memory for a copy of production scrape load, ideally in a separate environment from production. Third, a query inventory: every recording rule, alert expression and dashboard query, exported from your Grafana instance or rule files. Fourth, a named owner who can approve which differences are acceptable. Ask any partner to confirm which of these they need from you before they quote.

Does promtool catch queries that change meaning after an upgrade?

No. promtool checks syntax and structure: it can confirm that configuration, rules and web config parse and that rule unit tests pass, but it does not run your production queries against real data and compare the results. Changes such as label handling or regex behavior can alter query output while every file still validates. That is why the routine includes a comparison of query results on a canary server, run against the same inputs as the current version. Treat promtool as the first gate and the canary comparison as the evidence that the upgrade changes nothing you depend on.

How long should the canary run before we upgrade production?

Set the length by your own change window and by how often your alerts and dashboards see the conditions they must handle, not by a fixed number. The canary has to run long enough to cover your normal load cycle, including any weekly batch jobs or peak traffic that drive the alerts you care about. Agree the duration and the exit criteria in writing before the canary starts, including which query differences block the upgrade and who signs off. If your change window is short, reduce the query inventory to the queries that protect production and test the rest after the upgrade.

Do we need to test rollback before the upgrade?

Yes, and the answer depends on what the upgrade changes on disk. Before rollback is planned, confirm whether the new version has changed the storage format for the data you keep, because once storage has changed a downgrade may not read existing blocks. Document the restore path from a backup taken before the upgrade and test it on the canary. Prometheus stores data in a local time series database with a write-ahead log, and local storage is not clustered or replicated, so the backup and restore step matters as much as the version change.

When should we pay an outside team to help with the upgrade tests?

Consider outside help when your alert rules protect systems that cannot tolerate a missed or false alert, when no one on staff has time to build the CI harness and canary, or when the upgrade crosses several minor releases at once. DeployOpen plans and runs fixed-scope engagements in infrastructure you control, so the scope, deliverables and timeline are agreed in writing before work starts, and ongoing support can be added as a retainer. A quote follows from that written scope, so ask for the scope to list the checks, the canary duration, the handover and any retesting after the upgrade.

What makes upgrade testing take longer

This table lists the inventory items that stretch a Prometheus upgrade test cycle, what raises the effort for each, and what to measure before you estimate the work. Read it as a checklist: the rows with the largest counts in your estimate usually set the length of the canary period and the number of comparison runs.

DriverWhat raises the effortWhat to measure first
Rule files and unit testsMany rule files, or rules without unit test coverage, so promtool and promtool test rules have to be run and reviewed by handCount rule files, recording and alerting rules, and how many have test files that run in CI
Custom exporters and recording rulesExporters with changed metric names or label sets, and recording rules that feed dashboards or alerts, so one change propagates downstreamList custom exporters, their exposed metric families, and which recording rules depend on them
Dashboards and saved queriesMany dashboards with PromQL that uses regex matchers, le labels or functions whose behavior changed between versionsCount dashboards and panels, and extract the distinct queries they run
Alertmanager receivers and routesSeveral receivers, nested routes and inhibition rules that must be checked for delivery and routing behaviorCount receivers, routing tree depth, inhibition rules and silences kept in the configuration
Remote write or long-term storageRemote write queues, read paths to external stores and version compatibility that need to be confirmed on the canaryConfirm each remote write and remote read target, its protocol settings and whether the canary can send to it safely
Local data directory sizeLarge blocks and long retention make restart, WAL replay and storage format checks slower, and make rollback harder once storage has changedCheck the size of the data directory, configured retention by time or size, and the number of blocks
Number of scrape targetsMore targets mean more series to compare between production and canary, and more scrape failures to diagnose after the upgradeCount active targets per job from the targets page and note jobs that use service discovery

Keeping test routines alive between LTS upgrades

The test routine only protects you if it runs every time you adopt a new build, not just during the first migration. Each new Prometheus minor release starts a six-week cycle, and after those six weeks a minor generally stops receiving bug fixes, so a team following the minor line will repeat the promtool checks, rule unit tests and canary query comparison roughly every six weeks. A team on a long-term support line runs the same routine less often, but each patch still needs it: LTS releases get bug fixes for one year, so the routine should run on every LTS patch as well as on each move to a new LTS line. Keep the steps in version control with the configuration, and record the Prometheus version, the promtool version and the date of each run so the evidence trail shows which build was tested and when.

The rhythm inputs are the six-week minor cycle and the one-year LTS support window, and the second one sets your planning horizon. Before each LTS line reaches its end-of-support date, schedule the move to the successor line and budget time for the canary comparison, because the routine is the part of the upgrade you can prepare in advance. Confirm the current support dates on the Prometheus release cycle page before you set the calendar, since they change as new lines ship. Between upgrades, a short check is enough: re-run promtool check config and promtool test rules against your repository on every patch so that rule or configuration drift from routine changes is caught before a new build is involved.

Routines decay when nobody owns them, so assign a named owner for the test suite and the canary, and make the suite fail the build when a rule test or config check fails. Review the test fixtures whenever you add a service or alert, because a unit test that still passes against outdated input gives false confidence. Ask your implementation partner or internal team to confirm how the canary is refreshed from production configuration and how long its data is kept, since that determines whether a query comparison reflects current traffic. A test routine that is written down, scheduled and owned will still run when the next patch arrives.

How DeployOpen scopes and runs a Prometheus upgrade test

DeployOpen plans testing for Prometheus upgrades as a written, fixed-scope engagement run in your infrastructure. The work covers the promtool checks, rule unit tests in your CI, a canary comparison and a rollback limit set before the upgrade window opens.

How we scope

  • Inventory your Prometheus version, configuration files, rule files, web config and the target release line before work starts.
  • Agree in writing which promtool checks, rule unit test files and canary query comparisons are in scope.
  • Record which storage changes the target version makes, so rollback limits are stated before any upgrade begins.

How we build

  • Set up a repeatable promtool routine covering check config, check rules, check web-config and check service-discovery.
  • Write or extend rule unit test files and wire them into your CI pipeline, running several test files in one invocation.
  • Stand up a canary Prometheus with production-like scrape targets and compare key queries and alert rule results against the current server.

How we hand over

  • Deliver the test scripts, CI configuration, canary comparison queries and a written upgrade runbook in your repositories.
  • Document the go or no-go criteria, the rollback limits after storage changes, and the owner for each decision.
  • Walk your platform and on-call teams through the routine so the next upgrade can run without outside help.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer, agreed separately from the fixed-scope work.
  • Retainer scope can cover re-running the test routine for each new release on the line you follow.
  • Ask any partner to confirm release-line dates and support windows with the Prometheus release cycle documentation before planning.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.