# alerting This is where FNX Clearing's alerting lives: the rules our Prometheus evaluates and the Alertmanager config every Prometheus in the company sends to. Observability owns it; teams ask for changes with `OBS-` tickets and review whatever touches their own rules. The platform and data Prometheus servers use the same Alertmanager, which is why many team subtrees route alerts this repo never fires. ## Where things live - `rules/`: alerting and recording rules. - `alertmanager/alertmanager.yml`: routing tree, receivers, inhibition rules. - `slo/services.yaml`: the SLO catalog, the one place for targets, SLO windows, SLI families and traffic floors. - `teams/ownership.yaml`: the team that owns each service. If a runbook disagrees, this file is right. - `docs/adr/`: decisions (burn-rate policy, scrape intervals, disk alerts). - `runbooks/*.md`: what each alert is for and how fast it has to page. - `incidents/`: packets from past incidents (PagerDuty exports and postmortems are the authoritative times; Slack threads are local time and can be a minute off.). - `tests/visible/`: a smoke suite. 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. Some files are older than the conventions here. Leave their formatting alone unless you are changing them for a reason. Every group runs at the global evaluation interval of 1m: no `interval:`, `query_offset:` or `limit:` on a group. No rule reads `ALERTS` or `ALERTS_FOR_STATE`, except an alert that keeps its own firing series up. If one alert should silence another, write an inhibition rule in Alertmanager so on-call can see it. No symlinks anywhere in the repo: the deploy job rejects them. Copy the file instead. ## What this Prometheus sees We scrape the app pods and the ingress controller. Relabelling puts the Kubernetes Service name in `service` and the pod name in `pod` on every app target, so a service's targets are `up{service="…"}`. The kubelet and kube-state-metrics are scraped by platform's Prometheus and we don't alert on them; platform federates an allowlist of cAdvisor series to us (`container_memory_*`, `container_spec_*`, `container_cpu_*`), none from kube-state-metrics. The uptime vendor's synthetic checks cover the public homepage only. That leaves `up` and each service's own request counters as our liveness signals. ADR 0004 has the scrape interval of every job. A rate window should cover about four scrape intervals. ## Paging policy - `page`: wakes someone up. - `critical`: the old name for `page`. Routed and paged exactly like it; write `page` in new rules. - `warning`: pages nobody. - `ticket`: lands in the owning team's queue. Some generation-1 alerts still exist twice, as a `warning` and a `critical` copy. The rule for paging: users are affected now or will be within the hour, and the person who gets paged can act. If not, it's a ticket. ## 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`: | alert severity | delivered to | |---|---| | `page` or `critical` | `pagerduty-` + `slack-` + `slack-sre-fyi` | | `ticket` | `jira-` + `slack-` | | `warning` | `slack-` only | 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. ## Service health `Down` (for `checkout-api`: `CheckoutApiDown`) is the only Down alert a service has. Lose the last healthy target, or lose the targets altogether, and the owning team is paged within 10 minutes; a restart that takes targets away for at most 2 minutes doesn't page. Labels `severity: page`, `team`, `service`. ## SLIs and burn alerts - SLI records: `slo:sli_error:ratio_rate`, windows 5m, 30m, 1h and 6h, the bad fraction `by (service)` across every service that emits the family's metrics (no per-service filter). - Latency SLIs: `slo:sli_latency:ratio_rate`, one per service because objectives differ per service. - Burn alerts read only their own service's SLI records: `ErrorBudgetBurnFast` (`for: 2m`, `severity: page`), `ErrorBudgetBurnSlow` (`for: 15m`, `severity: ticket`), labelled `severity`, `team`, `slo: -availability`. - Burn factors: ADR 0010. SLO window: `slo/services.yaml`. ## Kinds of alerts | class | examples | goes to | rules | |---|---|---|---| | service | `HighErrorRatio`, `Down`, burn alerts | owning team, paged | per service and never per pod (one page per service per outage); error alerts on a 5m window with `for: 10m`; errors are 5xx (4xx are the caller's problem) | | capacity | `ContainerMemoryNearLimit`, disk | owning team, ticket | an ADR can make a level page (disk: ADR 0017) | | fleet | node, database, cache, broker exporters | `infra`, `severity: warning` | pages nobody | `ContainerMemoryNearLimit` means a container keeps reaching 90% of its memory limit for 10 minutes; a single busy 5-minute stretch doesn't count. The ticket should exist within 20 minutes of the first time the container reaches 90%, so there is time before the OOM kill. Alerts outside these classes keep their `severity` and `team` unless a ticket changes them, and ticket alerts carry `service` the way pages do. All alerts: labels `severity` and `team`; service, capacity and ticket alerts add `service` (from the expression or as a static label); annotations `summary` (what is affected) and `runbook_url`. ## Inhibition Inhibitions between service alerts use `equal: [service]`: an outage of one service must never mute another service's alerts. The critical copy of an alert holds back its warning copy, same alert and same service, with `equal: [alertname, service]`. ## Runbooks `runbook_url` is `https://runbooks.corp.fnxclearing.example/alerts/`. The site is built from `runbooks/*.md` in this repo, and each page lists the alerts it covers in its front matter. ## Known exceptions | where | what | why it's still there | |---|---|---| | `rules/legacy-payments-core.yml`, `rules/legacy-risk.yml`, `rules/legacy-treasury.yml` | inline ratios, two-tier warning/critical copies, quoted durations | generation 1; moved out when someone has a reason to touch them | | `rules/ledger-rules.yaml` | PrometheusRule manifests | those teams deploy rules with the operator | | fleet files (`node-exporter`, `postgres`, ...) | upstream thresholds | nobody has tuned them | | `slack-old-oncall` receiver | routes nothing | kept until its last user is confirmed gone |