# monitoring Alerting rules and routing for Halde Retail, maintained by observability. If you own a service, open a `OPS-` ticket for changes and expect to review the ones to your rules. One Alertmanager serves this Prometheus as well as the platform and data ones, so plenty of the routing below is for alerts defined elsewhere. ## Layout | path | contents | source of truth for | |---|---|---| | `rules/` | every alerting and recording rule | | | `alertmanager/alertmanager.yml` | routes, receivers, inhibitions | | | `slo/services.yaml` | the SLO catalog | SLO targets and windows, SLI family per service, traffic floors | | `teams/ownership.yaml` | owners | which team owns each service; beats any runbook | | `docs/adr/` | decisions | burn-rate policy, scrape intervals, disk alerts | | `runbooks/*.md` | one page per alert or service | what the alert means, how quickly it must page | | `incidents/` | packets from past incidents | times: PagerDuty and postmortems win; Slack is local time and sometimes a minute out | | `tests/visible/` | the smoke suite | nothing; it is not a spec | Two scripts: `bin/af-check` (what CI runs: promtool check, smoke tests, amtool check-config) and `bin/range2test`, which makes a promtool test out of a `query_range` pull from `incidents/`, for replaying an incident against your change. A word on old files: they predate the rules below, and we don't reformat them in drive-by changes. Groups all evaluate at the global interval (1m); `interval:`, `query_offset:` and `limit:` aren't used on groups here. Reading `ALERTS` or `ALERTS_FOR_STATE` from a rule is off limits; the only allowed case is an alert holding up its own firing series. Holding one alert back while another fires is Alertmanager's job (inhibition), visible to on-call. The deploy job fails on any symlink in the repo, so copy files rather than linking them. ## What this Prometheus sees This Prometheus scrapes our apps and the ingress. Every app target gets a `service` label from its Kubernetes Service name and a `pod` label at relabel time, so `up{service="…"}` is how you find a service's targets. kube-state-metrics and the kubelet live in the platform team's Prometheus, which we don't alert from. Platform federates a short allowlist of cAdvisor container series into ours (`container_memory_*`, `container_spec_*`, `container_cpu_*`) and nothing from kube-state-metrics. Synthetic checks run in the vendor's uptime tool, which only covers the public homepage. For us, `up` and the services' own request counters are the liveness signals. Scrape intervals per job are in ADR 0002. We size rate windows at about four scrape intervals. ## Severity and paging Severities: `page` gets someone out of bed; `critical` means the same thing in older rules (same routing, same page) and new rules say `page`; `warning` goes to Slack and pages nobody. A few generation-1 alerts come in pairs, a `warning` copy and a `critical` copy. A page is for users hurting now or within the hour, and only if the person paged can do something about it. Anything else is `severity: ticket` and goes to the owning team's queue. ## Routing The `team` label on the alert is the routing key and has to match `teams/ownership.yaml`. Each team has a subtree matching its `team`: | severity | receivers | |---|---| | page, critical | `pagerduty-`, `slack-`, and `slack-sre-fyi` | | ticket | `jira-`, `slack-` | | warning | `slack-` | SRE watches every page in #sre-fyi (`slack-sre-fyi`); nobody is paged from there. The root receiver `slack-alerts-default` is the catch-all for alerts with no `team`; nobody is on it. Rule evaluation failures go to `slack-prometheus-meta`. The paging unit is the service: one page per service per outage; two services failing together are two pages, even for the same team. Don't change receivers you don't own, `global`, or add time intervals. ## Down alerts Each service has one Down alert, `Down` (`checkout-api` → `CheckoutApiDown`). It pages the owning team within 10 minutes of the service losing its last healthy target, including when the targets are gone. A restart that drops targets for up to 2 minutes must not page. Labels: `severity: page`, `team`, and `service`. ## SLO alerting SLI records are `slo:sli_error:ratio_rate` for 5m, 30m, 1h and 6h: the bad fraction, `by (service)`, covering every service that emits the family's metrics (don't filter them by service). Latency SLIs are per service (`slo:sli_latency:ratio_rate`), because the objective is per service. Burn alerts only read the SLI records for their own service. Names: `ErrorBudgetBurnFast` (`for: 2m`, `severity: page`) and `ErrorBudgetBurnSlow` (`for: 15m`, `severity: ticket`), labels `severity`, `team` and `slo: -availability`. The factors come from ADR 0005 and the window in the catalog. ## Alert classes Service alerts are `HighErrorRatio`, `Down` and the burn alerts. They page the team that owns the service, and error alerts are per service, not per pod, so an outage is one page per service. Window 5m, `for: 10m`. Only 5xx count as errors; a 4xx is the caller's problem. Capacity alerts (`ContainerMemoryNearLimit`, disk) are tickets for the owning team unless an ADR makes a level page (disk: ADR 0008). `ContainerMemoryNearLimit` is for a container that keeps hitting 90% of its memory limit for 10 minutes, not for one busy 5-minute stretch, and the ticket should be open within 20 minutes of the first time it hits 90%, well before the OOM. Fleet alerts (node, database, cache and broker exporters) belong to `infra`, are `severity: warning`, and page nobody. All other alerts keep their `severity` and `team` unless a ticket asks for a change. Ticket alerts carry `service`, same as pages. Labels on every alert: `severity`, `team`. Service, capacity and ticket alerts carry `service` as well, from the expression or set statically. Annotations: a `summary` naming what is affected, and a `runbook_url`. ## Inhibition - service alerts holding back other service alerts: always `equal: [service]`, so no outage silences another service. - critical copy over warning copy of the same alert for the same service: `equal: [alertname, service]`. Cluster level: `ClusterUnreachable` (no `service` label) pages platform through `pagerduty-platform`; while it is firing, service pages from that cluster stay held back, `equal: [cluster]`. ## Runbooks `runbook_url` is `https://runbooks.halde.example/alerts/`. The site is built from `runbooks/*.md` in this repo, and each page lists the alerts it covers in its front matter. ## Changelog - 2025-11: burn alerts moved to the SLI records (ADR 0005). - 2026-02: `slack-sre-fyi` added; SRE stopped being paged for every team. - 2026-05: disk alerts per ADR 0008. - 2026-08: kafka-exporter scraped every 1m instead of 15s (ADR 0002).