Alerts as code, and the day the generic version lost
Two YAML files hold every production alert for a wireless estate; the interesting commits are the ones that put lines back.
The alerts repository is two files and almost nothing else (no rules directory, no templates, no generator). meta-dev.yml and meta-prod.yml each map an alert name to a destination, a PromQL expression, a dwell time and a link to its resolution document:
DRA_Routing_Failures:
description: "DRA is failing to route S6a requests"
destination: "opsgenie"
prometheus_expression: |-
sum(rate(dra_routing_failures_total[5m])) > 0.5
prometheus_for: "15m"
resolution_document: "https://<runbook>/dra-routing-failures"
Production currently carries 249 alerts over about 3,300 lines (the dev file is smaller and routes to Slack). A push to main that touches either file deploys both environments through a shared reusable workflow, dev and prod as separate jobs; before February 2026 the same job was a four-line Jenkinsfile. That is the entire mechanism. Everything below is what the mechanism let us find out.
Pinning 90 selectors to one job
The partner metrics (xcore_*, arriving by Prometheus federation) were selected by series name and an IP regex, with no job label:
xcore_pgw_count{qip=~"172\\.22\\.120\\.(6|7|12|13)"}
A sum() over that will add together series of the same name from any scrape source that happens to carry them, and the alert's threshold is a ratio against its own hour-old baseline — so a second source appearing changes the numerator and the denominator by different amounts. Adding job="partner-d_federate" to every one of those selectors scopes each expression to a single source. Ninety occurrences, across both files (609 lines touched in production, 76 in dev).
The same branch deleted a great deal of commented-out alert configuration: blocks disabled months earlier by ticket (each one carrying the ticket link that disabled it), left in place as comments and still read by everyone who opened the file. The merge removed 231 lines and added 104.
Where the generic alert lost
The DNS alerts were the opposite lesson. Twelve of them existed, six per roaming partner, each pinned to one provider's bind_exporter instance (one job label per resolver). After the resolvers moved to CoreDNS those twelve became four generic alerts matching every wireless-apn-dns-* job at once. The diff was the one everybody wants: 69 lines removed, 13 added.
It had to be undone within the day. OpsGenie renders an incident from .CommonAnnotations, which holds only the annotations identical across every alert in the group — and a description that covers four jobs cannot name the one instance that is down. The on-call engineer got an alert that said DNS was failing somewhere, with no instance in it at all. The replacement splits the alerts per job again, with the service name and instance written out in each description (hardcoded, because the group cannot interpolate them), and the legacy service names noted separately from the new convention. That commit added 110 lines.
So the final state is longer than the state the refactor replaced, and it is correct. A generic expression is cheaper to maintain and worth less at three in the morning; which of those matters depends on who reads the output, not on how the file looks.
Downgrading instead of deleting
Four tickets on one afternoon (13 November 2025) moved a batch of host alerts off the pager:
- ioops dropped to Slack entirely (seven lines gone from production, two changed in dev)
- memory split — 20% to Slack, 10% kept paging
- CPU load and disk space likewise
None of those alerts was wrong. Each was firing often enough that it had stopped being read, which is the same thing as not having it, except that it also buries the ones that matter.
What version control was actually for
Removing a partner's local-breakout alerts for SITE-B merged on 30 April 2026 and was reverted the next day (pull request #246, then #247). Not a rollback procedure, not a drift detector — git revert, a review, a merge, and the deploy workflow firing on the file change like any other commit.
Two other removals stayed removed, and both were removals of alerts on things that no longer existed: ping-failure alerts pointed at a subscriber database that had been migrated to a different vendor (37 lines, one left), and the 3G and GGSN proxy alerts after one partner's proxy count went from six to two and the other's path moved off its old gateway entirely (95 lines removed, 6 added).
An alert that watches something decommissioned is not neutral. It fires, somebody investigates, and the answer is that the alert is older than the architecture.