Sub topic 7
Metrics That Tell You Whether a Release Is Healthy
This chapter assumes you can read a Kubernetes Deployment, know what a load balancer does, and have seen service metrics such as error rate and latency on a dashboard. It covers which signals to watch during a release and how to read them. The next chapter uses these signals to decide whether to promote or abort a canary.
Why a release needs its own signals
A readiness probe tells you that a pod can answer /healthz. It does not tell you that checkout works, that responses are fast, or that the database queries behind them succeed. A version can pass every probe and still break users.
Release metrics close that gap. They measure what users experience, and they let you compare the new version against the old one while both are running.
The core signals
Most release decisions rest on four signals, often called the golden signals.
| Signal | What it measures | What a bad release looks like |
|---|---|---|
| Error rate | Share of requests that fail, such as HTTP 5xx | A jump above the baseline |
| Latency | How long requests take, usually p50, p95, and p99 | The tail (p99) grows first |
| Traffic | Requests per second reaching each version | A new version receiving far less than expected |
| Saturation | How full a resource is: CPU, memory, connections, queue depth | Memory climbing steadily, or connection pools running out |
Use percentiles for latency, not averages. A p99 of 4 seconds means one request in a hundred is slow, and an average hides that.
Add one or two business signals for the service you run. Examples are completed orders per minute, sign-ins, or payment success rate. A change can keep error rates flat and still break a feature, for example by returning a valid but empty page. Business metrics catch that kind of failure.
Compare against a baseline
A number only means something next to another number. Two baselines are common:
- Before the release. Compare the last hour of data with the hour before the deploy. This works for rolling updates, where all traffic ends up on the new version.
- Old version versus new version, at the same time. Compare the two versions side by side. This works for canary and blue-green, where both versions run together. It is the stronger comparison because traffic patterns, time of day, and downstream load affect both versions equally.
To compare versions, every metric needs a label that identifies the version. In Kubernetes you can add the version label to pods, as the earlier Service example does. Your metrics pipeline then copies it onto each series.
The query below, written for Prometheus, computes the 5xx error ratio for each version over five minutes. It assumes your requests counter is named http_requests_total and carries version and status labels.
sum by (version) (rate(http_requests_total{app="web", status=~"5.."}[5m]))
/
sum by (version) (rate(http_requests_total{app="web"}[5m]))If blue shows 0.2% and green shows 3%, the new version has a problem. Compare the two numbers, not the 3% alone.
Timing and sample size
Metrics lag. A scrape interval of 15 seconds and a five-minute rate window mean a failure can take several minutes to appear. Wait long enough before you trust a clean result.
Small samples mislead. If a canary receives 1% of 200 requests per minute, that is two requests per minute. One error among them is a 50% error rate for that minute, and it may be noise. Either let the canary run until it has served enough requests, or raise the traffic share.
Some problems also build slowly. Memory leaks, connection leaks, and cache warm-up issues may take an hour to show. Choose a bake time, the period you watch before declaring success, that matches how your service fails.
Set thresholds before you deploy
Decide what counts as unhealthy before the release starts. Write the rules down, for example:
- Error ratio of the new version is no more than 1 percentage point above the old version.
- p95 latency is no more than 20% above the old version.
- No pod restarts or out-of-memory kills.
- Payment success rate is within 1 percentage point of the old version.
Choosing thresholds during an incident invites wishful thinking. Pre-agreed numbers make the abort decision quick and keep it from becoming a debate.
Common errors
- Watching only infrastructure metrics. CPU and memory can look fine while users see errors.
- Averaging latency. The average hides the slow tail.
- No version label. You cannot tell which version causes a problem.
- Judging too early. A short window and low traffic give noisy results.
- Ignoring downstream effects. The new version may overload a database or another service. Watch their saturation too.
Exercise
A canary receives 5% of traffic. The overall service error rate moves from 0.5% to 0.7%, and the team says the release looks fine. What check should they run, and why?
Show answer
Filter the error rate by version and compare the canary with the stable version. If all of the canary's requests fail, 5% of traffic failing adds only about 5 percentage points of errors to the aggregate. Normal variation can mask that. A per-version query, such as the Prometheus ratio grouped by version, shows the canary's own error rate. They should also confirm the canary has served enough requests for the number to be meaningful.