openenvforge's picture
3amBench v0.2.0
44084af verified
|
Raw History Blame Contribute Delete
7.21 kB

alerting

Prometheus rules and the shared Alertmanager config for Nidaan Health. The observability team owns this repo. Service teams file SRE- tickets against it and review changes to their own rules. Alertmanager is shared with the platform and data Prometheus servers, so most team subtrees route alerts that don't come from here.

What's where

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 PagerDuty and postmortem times are the ones to trust; Slack exports are in local time, give or take a minute
tests/visible/ the smoke suite nothing; it is not a spec

bin/af-check is CI (promtool check, the smoke tests, amtool check-config). bin/range2test turns a query_range pull from an incident packet into a promtool test so you can replay it against a branch.

Older files predate the conventions below; don't reformat them in passing. All groups run at the global evaluation interval (1m); we don't use interval:, query_offset: or limit: on groups. Rules don't read ALERTS or ALERTS_FOR_STATE (an alert keeping its own firing series up is the one exception we allow): when one alert should hold another back, that's an inhibition rule in Alertmanager, where on-call can see it. The deploy job refuses a repo with symlinks in it, anywhere, so there are none: copy a file instead of linking it.

What we scrape

What we can see from here: our apps and the ingress. App targets are relabelled with service (the Kubernetes Service name) and pod; up{service="…"} lists a service's targets. Platform runs the Prometheus with the kubelet and kube-state-metrics in it, and we don't alert from that one. They federate a few cAdvisor container series into ours (container_memory_*, container_spec_*, container_cpu_*), and nothing from kube-state-metrics. The vendor's synthetic checks only watch the public homepage, so liveness here means up and the services' own request counters. Per-job scrape intervals: ADR 0004. Rate windows are sized at roughly 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.

Who gets what

Alerts are routed on their team label, which must be a team in teams/ownership.yaml. Every team has its own subtree, matched on team, that sends:

alert severity delivered to
page or critical pagerduty-<team> + slack-<team> + slack-sre-fyi
ticket jira-<team> + slack-<team>
warning slack-<team> only

slack-sre-fyi is #sre-fyi, where SRE sees every page; it pages nobody. Anything without a team ends up at the root receiver, slack-alerts-default, which nobody watches. Failed rule evaluations are routed to slack-prometheus-meta. We page per service: one page per service per outage, so two services down at once means two pages even when they belong to the same team. Leave other teams' receivers, global and time intervals alone (don't add any).

Down alerts

One Down alert per service, named <ServiceCamel>Down (so checkout-api has CheckoutApiDown). When a service has no healthy target left, and that includes having no targets at all, its owner gets paged within 10 minutes. Targets missing for 2 minutes or less (a restart) must not page. It carries severity: page, team and service.

SLOs

Error SLIs are recorded as slo:sli_error:ratio_rate<window> (windows 5m, 30m, 1h, 6h): the fraction of bad requests by (service), one record per window for every service with the family's metrics. Don't add a service filter to them. Latency SLIs are recorded per service as slo:sli_latency:ratio_rate<window>, since each service has its own objective. A burn alert reads its own service's SLI records and nothing else; it is called <ServiceCamel>ErrorBudgetBurnFast (severity: page, for: 2m) or <ServiceCamel>ErrorBudgetBurnSlow (severity: ticket, for: 15m) and is labelled severity, team and slo: <service>-availability. Factors: ADR 0006; window: the catalog.

Alert classes

  • Service alerts (<ServiceCamel>HighErrorRatio, <ServiceCamel>Down, burn alerts) page the owning team. Service error alerts are per service, never per pod; one page per service per outage. They use a 5m window and for: 10m. Errors are 5xx; 4xx are the caller's problem.
  • Capacity alerts (ContainerMemoryNearLimit, disk) open a ticket for the owning team, except where an ADR says a level pages (disk: ADR 0009). ContainerMemoryNearLimit opens a ticket when a container keeps reaching 90% of its memory limit for 10 minutes. One busy 5-minute stretch isn't that. We want the ticket inside 20 minutes of the first time it reaches 90%, which leaves time before the OOM.
  • Fleet alerts (node, database, cache, broker exporters) are infra's, severity: warning, and page nobody.
  • Any other alert keeps the severity and team it has unless a ticket says otherwise. Ticket alerts carry service like pages do.

Every alert has labels severity and team. Service, capacity and ticket alerts also carry service on the alert (from the expression or as a static label). Annotations: a summary that says what is affected, and runbook_url.

Inhibitions

Between two services' own alerts, equal: [service], so one service's outage never silences another's. A critical copy of an alert holds back the warning copy of the same alert for the same service: equal: [alertname, service].

Runbooks

Use https://runbooks.nidaan.example/alerts/<AlertName> as the runbook_url. The runbook site is built from runbooks/*.md, and the front matter of each page says which alerts it covers.

Known exceptions

where what why it's still there
rules/legacy-claims.yml, rules/legacy-payer-integrations.yml, rules/legacy-provider-data.yml inline ratios, two-tier warning/critical copies, quoted durations generation 1; moved out when someone has a reason to touch them
rules/member-experience-rules.yaml PrometheusRule manifests those teams deploy rules with the operator
fleet files (node-exporter, postgres, ...) upstream thresholds nobody has tuned them
slack-ops-legacy receiver routes nothing kept until its last user is confirmed gone