Alert design: symptoms not causes, and the page vs ticket line
Decide what is allowed to wake a person, route everything else to a queue, and put Alertmanager between your rules and the pager so one incident is one page
At 03:00 a database host's CPU sits at 95% for ten minutes. Checkout error ratio and latency are normal and the error budget is not burning. What should happen?
The previous two chapters gave the demo app an SLO and two ErrorBudgetBurn alerts, one labelled severity: page and one severity: ticket. That is the core of a good alert set. Most real alert sets do not look like that. They are hundreds of rules, written one incident at a time, each by someone sure that this time the CPU alert would have helped. This chapter is about the rules you remove, the line between waking someone and filing a ticket, and Alertmanager, the component that turns a dozen firing rules into one notification to the right person.
What a page costs
A page interrupts sleep, a meal, a child’s bedtime. The SRE book puts a number on the work behind one: root cause, remediation and follow-up take about 6 hours per incident, which is why Google’s limit is two incidents per 12-hour shift. More than that and the follow-up work does not happen, the same incident recurs, and the load grows.
The deeper cost is trust. An on-call engineer who is paged ten times a week for things that resolve themselves learns, correctly, that a page usually means nothing. They acknowledge from bed and go back to sleep. The SRE book’s phrase is that the fatigue noisy alerts induce causes serious alerts to be treated with less attention than necessary. Knight’s emails are the extreme case; the everyday one is the alert that has fired every Tuesday for a year and has a Slack thread of thumbs-up emoji under each occurrence.
So an alert set is a budget too. Every rule spends some of the on-call’s attention, and a rule that pages without a reason to act spends it on nothing.
Symptoms, not causes
The SRE book frames monitoring as answering two questions: what is broken, and why. A symptom is the what, as the user would describe it: checkouts fail, checkouts are slow, the site does not load. A cause is a candidate why: payments is returning 500s, Redis is down, CPU is high, a queue is long.
Page on symptoms. There are three reasons, and they compound.
Coverage. There is a short list of symptoms and an unbounded list of causes. The demo app has one user-facing operation, GET /checkout, so two SLOs describe everything a user can feel. The causes include every service, every dependency, every resource, and every way they interact. A cause-based set is never complete; a symptom-based one is complete by construction, because any cause that matters produces a symptom.
Precision. A cause can be present with no symptom. CPU at 95% is often a service doing its job. Payments failing 2% of charges is within a 99.9% SLO only if the gateway retries; without retries it is a symptom at the gateway, and the gateway’s alert sees it. A cause alert fires in both cases and is right in one.
One incident, one page. When payments fails, the payments error ratio, the orders error ratio, the gateway error ratio, the gateway p99 and the “any 5xx” rule all fire. Five pages for one fault, each claiming to be the problem. The lab measures this on the demo app.
Cause alerts are not banned. Ewaschuk’s “My Philosophy on Alerting” calls them bad but sometimes necessary, and the necessary ones share a shape:
- Imminent symptoms with a long lead time. A disk filling at a rate that hits 100% in four hours, a certificate expiring in seven days. Nothing hurts yet, and by the time something does it is too late to fix calmly. These are usually tickets, with a page only when the lead time is shorter than a working day.
- Blind spots in the symptom alerts. The burn-rate alerts divide failed checkouts by all checkouts. If the gateway is dead, there are no checkouts and the ratio has no samples, so nothing fires. The synthetic-monitoring chapter later in this module fixes that properly with a probe; until then,
up{job="gateway"} == 0is a cause alert that stands in for a symptom. - Failures the symptom cannot see. A broken idempotency key charges a customer twice and every request returns 200. That needs an alert on the invariant, not on a cause.
Everything else belongs on the dashboard the page links to. The payments error ratio is how a responder finds the cause in thirty seconds; it is not how they find out there is a problem.
The page vs ticket line
Before a rule is allowed to page, the SRE book asks whether it detects an otherwise undetected condition that is urgent, actionable, and actively or imminently user-visible. Ewaschuk’s version is that pages should be urgent, important, actionable and real. Combine them into four questions, and answer each for the specific person who will receive it:
| question | if the answer is no |
|---|---|
| Is it urgent: will waiting until working hours make it materially worse? | ticket |
| Is it actionable: can the person paged do something now, other than watch? | ticket, or automate the action |
| Is it user-visible now or within hours? | ticket or panel |
| Is it real: does it fire only when the condition is true? | fix the rule or delete it |
The second row is where most rules fail. If the response to a page is always the same command, the SRE book’s rule applies: a page that merits a robotic response should not be a page. Make the robot do it, and page when the robot fails.
A ticket is not a polite page. It needs a queue someone reads every working day, an owner, and a response time measured in days. PagerDuty’s alerting principles describe the same tiers: high urgency needs immediate human action at any hour, a business-hours tier needs action within 24 hours, low urgency needs action at some point, and anything else is a notification that should not wake anyone. If your organisation has no ticket queue that anyone reads, a ticket alert is a page that nobody acts on, and you are back to the emails.
The lowest tier is not an alert at all. A panel is a graph on the dashboard a page links to, and a record is a recording rule that a query can use. Neither notifies anyone. Most cause signals belong here.
For the demo app this gives two severities, used as label values:
severity: pagefor burn rates fast enough to spend a meaningful part of the month’s budget in hours, and for the edge being down.severity: ticketfor slow burns and for things that will become pages if nobody fixes them this week: the telemetry pipeline dropping data, rules failing to evaluate, a service crash-looping without user impact.
Keep the set of values that small and that strict. Routing matches exact label values, so a rule labelled critical, crit or P1 in a tree that knows only page and ticket goes wherever the default route sends it.
Alertmanager: from a firing rule to a person
Prometheus evaluates rules and sends firing alerts to Alertmanager every evaluation, as a list of label sets with annotations. It does not decide who hears about them. Alertmanager does, in a fixed order:
Routing is a tree. Each node has matchers, a receiver and optional timing settings that override its parent’s. An alert walks down from the root and stops at the first child that matches, unless that child sets continue: true. If no child matches, the root’s receiver gets it. For the demo app the tree is a root with two children, one matching severity="page" and one severity="ticket".
The default receiver is a design decision. Route unknown severities to the ticket queue and a mislabelled page is downgraded silently. Route them to the pager and a mislabelled ticket wakes someone, which gets the label fixed by morning. Teams with a loose rule review should default to the pager; this lab defaults to the ticket queue and catches mislabels with a test instead.
Grouping decides how many notifications an incident produces. group_by lists the labels that define a group; alerts with the same values for those labels go into one notification. Three timers control when it is sent:
| setting | default | what it does |
|---|---|---|
group_wait |
30s | how long a new group waits for more alerts before the first notification |
group_interval |
5m | how long to wait before notifying about changes (new alerts, resolutions) to a group that has already notified |
repeat_interval |
4h | how long before re-sending a notification for a group that is still firing and has not changed |
Group by the labels that identify the incident, not the instance. group_by: [alertname, slo] puts every replica’s copy of the same burn alert into one page. Grouping by instance sends one page per pod during a fleet-wide failure, which is what pages people forty times in an hour. The special value group_by: ['...'] groups by every label, which disables grouping; it exists for receivers that do their own deduplication.
The timers are a trade. A 10 s group_wait on the page route gets the page out fast and risks a second notification when a related alert fires 20 s later. A 2 m group_wait on the ticket route costs nothing, since nobody reads tickets at that speed, and collects more of the group. repeat_interval on a page is how often an unacknowledged incident nags; real paging services have their own escalation, so an hour is enough.
Inhibition mutes alerts while another alert is firing. An inhibit rule has source_matchers (the alert that must be firing), target_matchers (the alerts to mute) and equal (labels that must have the same value on both). The classic use for SLO alerts: while the fast-burn page fires for checkout-availability, the slow-burn ticket for the same SLO is redundant.
inhibit_rules:
- source_matchers: ['alertname="ErrorBudgetBurn"', 'severity="page"']
target_matchers: ['alertname="ErrorBudgetBurn"', 'severity="ticket"']
equal: [slo]
Two details from the Alertmanager documentation matter. A missing label and an empty label are the same thing, and if every label in equal is missing from both source and target, the rule applies. So a broad rule such as “any page inhibits any ticket with the same slo” lets GatewayDown, which has no slo label, mute every ticket that has none either: the Collector dropping data, rules failing to evaluate. Write inhibit rules narrowly, naming the alerts on both sides. Second, an alert that matches both the source and the target of a rule cannot be inhibited by another alert that also matches both, so a rule cannot make alerts mute each other in a circle; the documentation recommends choosing matchers so no alert matches both sides.
Silences are inhibition by hand: a set of matchers and an end time, created in the UI or with amtool silence add, for planned work or for a known incident that is already being handled. A silence without an expiry is a deleted alert that nobody reviewed, so give each one a duration and a comment. Mute time intervals silence a route on a schedule; the useful version for tickets is “not at weekends”, and the dangerous version is anything on a page route.
Auditing an alert set
An inherited alert set is cheaper to audit than to defend. The procedure is mechanical, and it is the lab:
- List every rule with its labels.
curl localhost:9090/api/v1/rulesgives name, expression,for:and labels for all of them. - Ask the four questions of each. Urgent, actionable, user-visible, real. Write the verdict next to it: page, ticket, panel, or delete.
- Look for coverage. For each cause alert, name the symptom alert that fires for the same incident. If one exists, the cause alert is a panel. If none exists, you have found a hole in the symptom set; fix that rather than keeping the cause alert.
- Look at history. For each rule, how often did it fire in the last 30 days, and how often did someone do something because of it? A rule that fired 40 times and was actioned twice is a delete or a ticket. The runbooks chapter that follows turns this into a weekly metric.
- Normalise labels. Every surviving rule gets
severity: pageorseverity: ticket, an owner, and the annotations the receiver needs: asummarywith numbers in it and, from the next chapter, arunbook_url. - Test the routing.
amtool config routes testtakes a label set and prints the receiver, which makes the routing tree something CI can check.
Expect to delete most of what you inherit. The lab’s twenty rules shrink to six, and the two most important alerts on the demo app are not in that file at all: they are the burn-rate pages you already have.
Where alert design goes wrong
- Thresholds copied from a blog. “Error ratio above 1% for 5 minutes” is a fine first alert and a bad steady state: it pages on a burst that spends 0.2% of the month’s budget and misses a 0.5% error ratio that spends all of it in 8 days. Burn-rate alerts exist because static thresholds cannot be tuned to both.
for:as a noise filter. Afor:of 10 minutes on a noisy rule makes the page later, not better. If the expression flaps, fix the expression: a longer rate window, a burn rate, a minimum request count.- Alerts with no traffic guard. A ratio at 03:00 with 3 requests a minute crosses 1% on a single failure. Burn rates over an hour smooth this; a static ratio needs
and sum(rate(...)) > N. - Alerting through the thing that is broken. An alert that Prometheus cannot reach Alertmanager is delivered by Alertmanager. Meta-monitoring needs a path that does not depend on the pipeline it watches; the platform module builds it with a dead-man switch.
- Labels as free text.
severity: Criticalandseverity: criticalare different routes. Validate labels in CI withpromtool check rulesplus a script, or a unit test of the routing tree. - Never deleting. Every postmortem adds an alert; nothing removes one. Make the audit a quarterly calendar entry, and make “this alert fired and nobody acted” a reason to delete it, not a reason to explain it.
You will put Alertmanager between Prometheus and a stand-in pager, route on severity, load an inherited set of twenty alerts, measure how loud one fault is, then cut the set to six and measure again.
1. Start the stack and check the SLO alerts are loaded.
cd labs/observability
printf 'OTEL_SDK_DISABLED=false\nLOG_FORMAT=json\nOTEL_SEMCONV_STABILITY_OPT_IN=http/dup\n' > .env
docker compose --profile telemetry up -d --build
sleep 20
curl -s localhost:9090/api/v1/rules | jq -r '.data.groups[].rules[] | select(.type=="alerting") | "\(.name)\t\(.labels.severity)\t\(.health)"'ErrorBudgetBurn page ok and ErrorBudgetBurn ticket ok from the burn-rate chapter, plus GatewayHighErrorRatio and GatewayHighP99 if you kept red-gateway.yml from the RED chapter and the synthetic alerts if you have done that chapter already. If the ErrorBudgetBurn lines are missing, finish the burn-rate lab first: everything below routes on them.2. Add a stand-in pager. Alertmanager needs somewhere to send notifications. Instead of PagerDuty and Jira, a small webhook receiver prints one line per notification. Create pager/pager.py:
"""Stand-in for PagerDuty and Jira: prints one line per Alertmanager notification."""
import json
from datetime import datetime, timezone
from http.server import BaseHTTPRequestHandler, HTTPServer
class Hook(BaseHTTPRequestHandler):
def do_POST(self):
body = json.loads(self.rfile.read(int(self.headers["Content-Length"])))
names = sorted({a["labels"].get("alertname", "?") for a in body["alerts"]})
runbook = body["commonAnnotations"].get("runbook_url", "-")
print(f"{datetime.now(timezone.utc):%Y-%m-%dT%H:%M:%SZ} {self.path:<7} {body['status']:<8} "
f"alerts={len(body['alerts'])} group={json.dumps(body['groupLabels'])} "
f"names={','.join(names)} runbook={runbook}", flush=True)
self.send_response(200)
self.end_headers()
def log_message(self, *args):
pass
HTTPServer(("", 9099), Hook).serve_forever()The path tells you which receiver sent it: /page or /ticket. The runbook column stays - until the next chapter.
3. Write the Alertmanager config. Create alertmanager/alertmanager.yml:
# Routing for the demo app: severity=page wakes someone, severity=ticket waits for morning.
route:
receiver: ticket # anything without a known severity lands here
group_by: [alertname, slo]
group_wait: 30s
group_interval: 5m
repeat_interval: 4h
routes:
- matchers: ['severity="page"']
receiver: page
group_wait: 10s
repeat_interval: 1h
- matchers: ['severity="ticket"']
receiver: ticket
group_wait: 2m
group_interval: 30m
repeat_interval: 24h
inhibit_rules:
# A fast burn already paged for this SLO: the slow-burn ticket for the same SLO adds nothing.
- source_matchers: ['alertname="ErrorBudgetBurn"', 'severity="page"']
target_matchers: ['alertname="ErrorBudgetBurn"', 'severity="ticket"']
equal: [slo]
# The gateway is down: a crash-loop ticket for the gateway is the same incident.
- source_matchers: ['alertname="GatewayDown"']
target_matchers: ['alertname="ServiceCrashLooping"']
equal: [job]
receivers:
- name: page
webhook_configs:
- url: http://pager:9099/page
- name: ticket
webhook_configs:
- url: http://pager:9099/ticket4. Add both to compose, pinned. In compose.yaml, under services:, next to prometheus: and at the same indentation, add:
alertmanager:
image: prom/alertmanager:v0.28.1
profiles: ["telemetry"]
restart: unless-stopped
command:
- --config.file=/etc/alertmanager/alertmanager.yml
- --storage.path=/alertmanager
- --cluster.listen-address= # one instance: no HA gossip
volumes: ["./alertmanager:/etc/alertmanager:ro"]
ports: ["9093:9093"]
pager:
image: atlas-observability/gateway # reuse an image that already has Python
profiles: ["telemetry"]
restart: unless-stopped
command: ["python", "/pager/pager.py"]
volumes: ["./pager:/pager:ro"]Then point Prometheus at Alertmanager and scrape it. In prometheus/prometheus.yml, add a top-level block after rule_files::
alerting:
alertmanagers:
- static_configs:
- targets: ["alertmanager:9093"]and at the end of scrape_configs::
- job_name: alertmanager
static_configs:
- targets: ["alertmanager:9093"]Start them, validate, reload Prometheus:
docker compose --profile telemetry up -d alertmanager pager
docker compose exec alertmanager amtool check-config /etc/alertmanager/alertmanager.yml
curl -s -X POST localhost:9090/-/reload
sleep 10
curl -s localhost:9090/api/v1/alertmanagers | jq -r '.data.activeAlertmanagers[].url'amtool prints Checking '/etc/alertmanager/alertmanager.yml' SUCCESS and a summary: 2 receivers, 2 inhibit rules. Prometheus lists one active Alertmanager, http://alertmanager:9093/api/v2/alerts. The Alertmanager UI is at http://localhost:9093 and shows no alerts yet. Silences live in the container’s anonymous volume, so recreating the container forgets them; a real deployment mounts storage and runs two or three replicas with the gossip this lab turned off.5. Test the routing tree before anything fires.
AMT="docker compose exec alertmanager amtool config routes test --config.file=/etc/alertmanager/alertmanager.yml"
$AMT alertname=ErrorBudgetBurn severity=page slo=checkout-availability
$AMT alertname=ErrorBudgetBurn severity=ticket slo=checkout-latency
$AMT alertname=PaymentsErrorRatioHigh severity=critical
$AMT --verify.receivers=page alertname=GatewayDown severity=page; echo "exit $?"
docker compose exec alertmanager amtool config routes --config.file=/etc/alertmanager/alertmanager.ymlpage, ticket, ticket, then page and exit 0, then the tree drawn as text. The third line is the trap in action: critical is not a severity the tree knows, so the alert falls to the root receiver. In this lab that is the ticket queue. --verify.receivers exits 1 on a mismatch, which is how you put the routing tree under CI.6. Load the inherited alert set. You have inherited this file from a team that has since moved on. Save it as prometheus/rules/inherited.yml. Its first two rules are the ones from the RED chapter, so remove that file to avoid counting them twice:
groups:
- name: inherited
rules:
- alert: GatewayHighErrorRatio
expr: |
sum(rate(http_server_request_duration_seconds_count{job="gateway", http_response_status_code=~"5.."}[5m]))
/
sum(rate(http_server_request_duration_seconds_count{job="gateway"}[5m])) > 0.01
for: 5m
labels: { severity: page }
- alert: GatewayHighP99
expr: histogram_quantile(0.99, sum by (le) (rate(http_server_request_duration_seconds_bucket{job="gateway"}[5m]))) > 0.5
for: 10m
labels: { severity: page }
- alert: CheckoutAnyError
expr: sum(increase(http_requests_total{job="gateway",route="/checkout",status=~"5.."}[1m])) > 0
labels: { severity: critical }
- alert: OrdersErrorRatioHigh
expr: |
sum(rate(http_requests_total{job="orders",route="/orders",status=~"5.."}[5m]))
/ sum(rate(http_requests_total{job="orders",route="/orders"}[5m])) > 0.01
for: 5m
labels: { severity: critical }
- alert: PaymentsErrorRatioHigh
expr: |
sum(rate(http_requests_total{job="payments",route="/charge",status=~"5.."}[5m]))
/ sum(rate(http_requests_total{job="payments",route="/charge"}[5m])) > 0.01
for: 5m
labels: { severity: critical }
- alert: PaymentsLatencyHigh
expr: histogram_quantile(0.99, sum by (le) (rate(http_request_duration_seconds_bucket{job="payments",route="/charge"}[5m]))) > 1
for: 5m
labels: { severity: critical }
- alert: OrdersLatencyHigh
expr: histogram_quantile(0.95, sum by (le) (rate(http_request_duration_seconds_bucket{job="orders",route="/orders"}[5m]))) > 0.5
for: 5m
labels: { severity: warning }
- alert: GatewayDown
expr: up{job="gateway"} == 0
for: 1m
labels: { severity: critical }
- alert: OrdersDown
expr: up{job="orders"} == 0
for: 1m
labels: { severity: critical }
- alert: PaymentsDown
expr: up{job="payments"} == 0
for: 1m
labels: { severity: critical }
- alert: HighCPU
expr: rate(process_cpu_seconds_total{job=~"gateway|orders|payments"}[5m]) > 0.8
for: 5m
labels: { severity: critical }
- alert: HighMemory
expr: process_resident_memory_bytes{job=~"gateway|orders|payments"} > 512e6
for: 5m
labels: { severity: warning }
- alert: ServiceRestarted
expr: changes(process_start_time_seconds{job=~"gateway|orders|payments"}[15m]) > 0
labels: { severity: warning }
- alert: InFlightHigh
expr: sum by (job) (http_requests_in_flight) > 20
for: 2m
labels: { severity: warning }
- alert: TrafficHigh
expr: sum(rate(http_requests_total{job="gateway",route="/checkout"}[5m])) > 50
for: 5m
labels: { severity: info }
- alert: TrafficLow
expr: sum(rate(http_requests_total{job="gateway",route="/checkout"}[5m])) < 1
for: 5m
labels: { severity: critical }
- alert: OrdersTooManyStatements
expr: |
sum(rate(db_client_operations_total{job="orders"}[5m]))
/ sum(rate(http_requests_total{job="orders",route="/orders"}[5m])) > 4
for: 5m
labels: { severity: critical }
- alert: CollectorExportFailing
expr: sum(rate({__name__=~"otelcol_exporter_send_failed_(spans|metric_points|log_records)(_total)?"}[5m])) > 0
labels: { severity: critical }
- alert: RuleEvaluationFailing
expr: increase(prometheus_rule_evaluation_failures_total[10m]) > 0
labels: { severity: warning }
- alert: AlertmanagerNotificationsFailing
expr: rate(alertmanager_notifications_failed_total[5m]) > 0
labels: { severity: info }rm -f prometheus/rules/red-gateway.yml
docker compose exec prometheus promtool check rules /etc/prometheus/rules/inherited.yml
curl -s -X POST localhost:9090/-/reloadSUCCESS: 20 rules found. The Collector rule matches its metric names with and without a _total suffix, because Collector releases have exposed both; that is the kind of detail an inherited rule hides until the day it silently matches nothing.7. One fault, measured. Turn on a modest payments fault, the kind that happens every week, and watch for twelve minutes:
FAULT_ERROR_RATE=0.03 FAULT_SLOW_PAYMENTS_PCT=5 docker compose --profile telemetry up -d payments
sleep 720
curl -sG localhost:9090/api/v1/query --data-urlencode 'query=count by (alertname, severity) (ALERTS{alertstate="firing"})' \
| jq -r '.data.result[] | "\(.metric.severity)\t\(.metric.alertname)"' | sort
docker compose logs --no-log-prefix pager | awk '{print $2}' | sort | uniq -c
docker compose logs --no-log-prefix pager | tail -n 12CheckoutAnyError, OrdersErrorRatioHigh, PaymentsErrorRatioHigh, PaymentsLatencyHigh, GatewayHighErrorRatio, GatewayHighP99 once its 10-minute for: passes, and OrdersLatencyHigh flapping around its threshold, since 5% slow charges sit right at the p95. ErrorBudgetBurn with severity: ticket is probably firing as well: 3% errors is a burn rate of 30, and on a young stack the 3-day window holds little clean history. The page is a matter of history too: with an hour of clean data the one-hour window needs about half an hour at this rate to cross 14.4 times the budget; with less, it crosses sooner. The pager log shows one notification per alert name, mostly on /ticket, because the critical rules fell through to the root; only the two inherited page rules reached /page. Five rules described one fault, and the one the team called critical went to a queue.8. Audit. For each of the twenty rules, write a verdict using the four questions in the chapter. Then compare with this one:
| rule | verdict | why |
|---|---|---|
| GatewayHighErrorRatio, GatewayHighP99 | delete | ErrorBudgetBurn covers both SLOs, fast on a cliff and quiet on a blip |
| CheckoutAnyError | delete | one failure is within budget by design |
| OrdersErrorRatioHigh, PaymentsErrorRatioHigh, PaymentsLatencyHigh, OrdersLatencyHigh | delete (panels) | causes one hop down; the checkout SLO sees every one that hurts |
| OrdersDown, PaymentsDown | delete | the gateway returns 502 and the burn alert fires |
| HighCPU, HighMemory, InFlightHigh | delete (panels) | no user symptom, no action at 3 am |
| TrafficHigh | delete | success is not an incident |
| TrafficLow | delete | at night it pages on quiet; a dead edge is GatewayDown, and the synthetic chapter adds a probe |
| GatewayDown | page | the one hole in the burn alerts: no requests, no ratio |
| ServiceRestarted | ticket, rewritten | one restart is a deploy; more than three an hour is a crash loop |
| OrdersTooManyStatements | ticket | an N+1 regression costs capacity before it costs users |
| CollectorExportFailing | ticket | telemetry loss blinds the next incident |
| RuleEvaluationFailing | ticket | a rule that cannot evaluate cannot fire |
| AlertmanagerNotificationsFailing | ticket | delivered through the ticket integration when the pager integration is the one failing |
Fourteen deleted, six kept. Write the survivors as prometheus/rules/alerts.yml, with the severities your routing tree knows and a summary a human can act on:
# What survived the audit. The SLO pages live in slo-alerts.yml.
groups:
- name: alerts
rules:
# Page: the front door is not answering. The burn-rate alerts cannot see this,
# because a dead gateway exports no requests and the error ratio has no samples.
- alert: GatewayDown
expr: up{job="gateway"} == 0
for: 2m
labels: { severity: page }
annotations:
summary: "Prometheus cannot scrape the gateway: checkout is probably unreachable"
# Tickets: things a human should fix in working hours, before they become pages.
- alert: ServiceCrashLooping
expr: changes(process_start_time_seconds{job=~"gateway|orders|payments"}[1h]) > 3
labels: { severity: ticket }
annotations:
summary: "{{ $labels.job }} restarted {{ $value }} times in the last hour"
- alert: OrdersTooManyStatements
expr: |
sum(rate(db_client_operations_total{job="orders"}[15m]))
/ sum(rate(http_requests_total{job="orders",route="/orders"}[15m])) > 4
for: 30m
labels: { severity: ticket }
annotations:
summary: "orders runs {{ $value | printf \"%.1f\" }} SQL statements per order (normal is 3): N+1 regression?"
- alert: CollectorExportFailing
expr: sum(rate({__name__=~"otelcol_exporter_send_failed_(spans|metric_points|log_records)(_total)?"}[5m])) > 0
for: 15m
labels: { severity: ticket }
annotations:
summary: "The Collector is dropping telemetry: the next incident will be debugged half blind"
- alert: RuleEvaluationFailing
expr: increase(prometheus_rule_evaluation_failures_total[10m]) > 0
labels: { severity: ticket }
annotations:
summary: "Rule group {{ $labels.rule_group }} is failing to evaluate: some alerts cannot fire"
- alert: AlertmanagerNotificationsFailing
expr: sum by (integration) (rate(alertmanager_notifications_failed_total[5m])) > 0
for: 5m
labels: { severity: ticket }
annotations:
summary: "Alertmanager cannot deliver {{ $labels.integration }} notifications"rm prometheus/rules/inherited.yml
docker compose exec prometheus promtool check rules /etc/prometheus/rules/alerts.yml
curl -s -X POST localhost:9090/-/reload
sleep 60
curl -sG localhost:9090/api/v1/query --data-urlencode 'query=count by (alertname, severity) (ALERTS{alertstate="firing"})' \
| jq -r '.data.result[] | "\(.metric.severity)\t\(.metric.alertname)"'SUCCESS: 6 rules found. With the 3% fault still running, the firing list holds only ErrorBudgetBurn: the ticket, and the page if its windows have crossed. None of the six surviving rules describes this fault, and that is the design working: three percent of checkouts failing deserves a page within the hour, not five pages within the minute. The deleted rules stop reaching Alertmanager at once; their resolved notifications arrive later, up to the ticket route’s 30-minute group_interval for the ones that fell through to /ticket.9. A fast burn: one page, and the ticket inhibited. Make the fault severe and watch the routing work:
FAULT_ERROR_RATE=0.25 FAULT_SLOW_PAYMENTS_PCT=0 docker compose --profile telemetry up -d payments
sleep 600
docker compose logs --no-log-prefix --since 10m pager
curl -s localhost:9093/api/v2/alerts | jq -r '.[] | "\(.labels.alertname)\t\(.labels.severity)\t\(.labels.slo)\t\(.status.state)\tinhibitedBy=\(.status.inhibitedBy | length)"'/page line for ErrorBudgetBurn with group={"alertname": "ErrorBudgetBurn", "slo": "checkout-availability"} a few minutes after the change: at 25% errors the burn rate is 250, the five-minute window crosses at once, and the one-hour window needs at most about four minutes. In Alertmanager’s own list the page is active, and the ticket-severity ErrorBudgetBurn for the same SLO, firing since step 7, shows as suppressed with inhibitedBy=1: no new /ticket line for it while the page lasts. One incident, one page. Put payments back with docker compose --profile telemetry up -d payments and the page resolves once both of its branches clear, about five minutes later with six hours of clean history and up to 30 minutes on a young stack, as the burn-rate chapter showed. The resolved notification follows within one group_interval, and only then is the ticket released from inhibition.severity="Page", a one-character typo, and reload with curl -s -X POST localhost:9093/-/reload. amtool check-config still says SUCCESS, because the file is valid. Run the fast-burn fault from step 9 again: the page arrives on /ticket, where it would sit until morning. Then run $AMT --verify.receivers=page alertname=ErrorBudgetBurn severity=page slo=checkout-availability; echo $? and it exits 1. Syntax checks do not catch routing mistakes; a test that names the receiver each critical alert must reach does, and it belongs in the same CI job as promtool check rules. Fix the typo before you go on.The payments team owns the payments service. After an incident in which payments failed 2% of charges for an hour, they want a page of their own: PaymentsErrorRatioHigh, payments 5xx above 1% for 5 minutes, routed to the payments on-call. Checkout already has burn-rate pages owned by the platform on-call. What do you do?
- POST My Philosophy on Alerting Rob Ewaschuk
The essay this chapter's rules come from, written by a Google SRE: pages must be urgent, important, actionable and real; symptoms over causes; when cause-based alerts are worth it; tickets and playbooks. Short; read all of it.
- BOOK Site Reliability Engineering, chapter 6: Monitoring Distributed Systems Rob Ewaschuk, edited by Betsy Beyer, 2016
The book version of the same ideas, with the questions every paging rule must answer and the black-box versus white-box distinction. The section on the four golden signals overlaps the RED chapter; skip it. Read: sections 'Symptoms Versus Causes', 'As Simple as Possible, No Simpler' and 'Tying These Principles Together'.
- DOC Alertmanager configuration
The reference for every field in the lab's alertmanager.yml: route, the three timers and their defaults, matchers, inhibit_rule with its rules on missing labels, and the webhook payload. Read the route and inhibit_rule sections; skip the receiver integrations you do not use.
- DOC Prometheus: Alerting (best practices)
One page from the Prometheus maintainers: alert on symptoms high in the stack, batch jobs, capacity, and meta-monitoring. Five minutes to read and a good checklist for the audit.
- DOC PagerDuty Incident Response: Alerting Principles
A vendor's own internal policy, published: four urgency tiers with what each requires of a human, and the rules that alerts link to a runbook and that untested alerts count as no alert.
- DOC Order Instituting Proceedings: Knight Capital Americas LLC U.S. Securities and Exchange Commission, 2013
The primary source for the Why above. Paragraphs 12 to 19 cover the deployment and the 97 emails; the rest is regulatory findings you can skip.
All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.