Quick reference
Dashboards, alerts and pipelines that live in the repository.
- Review the signal — Rules, dashboards and collector config in the same pull request as the code.
- Test the rules — promtool check and test, with synthetic series and the page you expect.
- Provision the view — Dashboards from files or Terraform, never from a UI session.
- Own the pipeline — service.name, team and runbook on every artefact you ship.
In one line: Signals with owners. Observability you can rebuild is observability you can trust.
Start this week:
- Move one alert rule into the repository this week.
- Run promtool test rules on it before the next deploy.
- Delete one dashboard nobody has opened this quarter.
Explained
Rules. An alert is a query with a promise, so it needs a test. promtool check validates the syntax and the PromQL; promtool test rules runs the query against synthetic series and asserts which alerts fire. The runbook link sits in the annotation, where on-call will read it.
Dashboards. Grafana provisioning reads files at start-up, and the Terraform Grafana provider manages dashboards through the API. A hand edit is a change the next deploy overwrites: a polite way of saying it never happened.
Pipelines. The collector config is a file with receivers, processors, exporters and pipelines. otelcol validate catches the typo before it becomes a silent drop, and service.name is what makes a trace findable.
Ownership. service, team, runbook and severity on every artefact. An alert without a team pages nobody, and a dashboard without an owner is a panel nobody deletes.
Checklist
Run it before the first on-call shift and after every service change. A line that cannot be answered is the next ticket.
Artefacts
- Alert rules are in the repository and reviewed.
- Dashboards are provisioned, not hand-edited.
- Collector config is versioned with the services.
Checks
- promtool check and test run in CI.
- otelcol validate runs before deploy.
- Every rule has an owner and a runbook link.
Delivery
- The same commit ships code and telemetry.
- Applying from a laptop is not a supported path.
- A rollback restores rules and dashboards together.
Lifecycle
- Retired services lose their rules in the same pull request.
- SLOs are generated, not copied.
- A quarterly review deletes what nobody reads.
The field guide
The full guide of the PDF (P1059), page by page.
Signals you can review (the shift)
A dashboard built by hand at 2 am is a rumour with a graph. Observability as code puts the signal definition in the same review as the service.
The test is simple: clone the repository, apply it to an empty project, and get the same alerts and the same dashboards. If a step needs a click, it is not code yet.
- Metrics, alerts, dashboards and sampling rules live next to the service.
- Every rule has an owner, a runbook link and a severity.
- Changes arrive by pull request, with the diff visible.
- The same commit deploys the service and its telemetry.
| Artefact | Where it lives |
|---|---|
| Alert rules | rules/*.yml, loaded by Prometheus |
| Dashboards | provisioning JSON or Terraform |
| Collector config | otelcol.yaml in the repo |
| SLOs | slo.yaml, generated into rules |
The empty project test Apply the repository to a new environment and see whether the alerts appear. A README that says click three times is not a deployment.
If rebuilding the dashboard needs a person who remembers the clicks, the dashboard is not code.
Alerts are code, so test them (rules)
An alert rule is a query with a promise attached. Both parts need a test, and Prometheus ships the tool.
Check, then test
promtool check config prometheus.yml
promtool check rules rules/api.yml
promtool test rules tests/api-rules.ymlcheck validates the syntax and the PromQL. test runs the rule against synthetic series and asserts which alerts fire, which is the only way to know that a threshold still matches the traffic.
- Name the alert after the symptom, not the cause.
- Put the runbook URL in the annotations, next to the summary.
- Give the rule a for window long enough to survive a scrape.
- Delete the rule with the service, in the same pull request.
A test file is documentation The test cases show the expected traffic and the expected page, which is more than most runbooks say.
An untested alert rule is a query that may fire, and a promise nobody checked.
Provision the view, do not paint it (dashboards)
A dashboard is a JSON document with a version. Treat it like any other artefact: store it, review it, deploy it.
Grafana provisioning reads files at start-up, and the Terraform Grafana provider manages dashboards through the API. Either way, the dashboard exists before someone opens the UI, and a hand edit is a change that will be overwritten.
A provisioned dashboard path
apiVersion: 1
providers:
- name: acme
type: file
options:
path: /etc/grafana/provisioning/dashboards| Route | When it fits |
|---|---|
| Provisioning files | One Grafana, config in the image |
| Terraform provider | Many environments, one source |
| HTTP API in CI | An existing pipeline, no new tool |
| Hand edit | Never, if you want it back |
The dashboard nobody owns A panel with no owner is a panel nobody deletes. Add the team and the service to the dashboard tags.
A dashboard that cannot be rebuilt from the repository is a screenshot with extra steps.
The collector is configuration (pipelines)
Traces and logs travel through a pipeline, and that pipeline is a file. Validate it before it ships, and version it with the services it serves.
Validate before deploy
otelcol validate --config=otelcol.yaml
otelcol componentsThe collector config names receivers, processors, exporters and the service pipelines that connect them. A typo in a pipeline name is a silent drop, so validation belongs in CI next to the unit tests.
- Set service.name and deployment.environment on every resource.
- Sample at the collector, not in five client libraries.
- Keep one gateway config, not one per team.
- Alert on the collector's own queue depth and dropped data.
Cardinality is a budget A label with user ids turns a metric into a database. Decide the label set in the pull request, where it is cheap to argue about.
Telemetry you cannot validate is telemetry you will debug during an incident.
Ship it with an owner (ownership)
A rule, a dashboard or a pipeline without an owner is deleted by the next reorganisation. Ownership is part of the code, not a spreadsheet.
- Put the service name and team in every artefact's labels.
- Link the runbook from the alert annotation.
- Review the telemetry diff in the same pull request as the code.
- Apply through the pipeline, never from a laptop.
- Delete the signal when the service is retired.
| Field | Why it earns its place |
|---|---|
| service | Groups signals by the thing that broke |
| team | Routes the page to the people who fix it |
| runbook | Cuts the first five minutes of an incident |
| severity | Decides page, ticket or dashboard |
Slos as a file
sloth generate -i slo.yaml
kubectl apply -f slo-rules.yamlThe pull request is the control If the alert change and the code change can land separately, they will. One review, one rollback.
An alert with a team name and a runbook is a control. The rest is telemetry.
The honest caveat: code does not make a bad signal good. A noisy rule deployed by pipeline is still noisy, only now it pages every fifteen minutes.
The lesson: if you cannot rebuild the signal from the repository, you do not have it.
Your turn: Which signal would you struggle to rebuild today?
Related on this site
More notes: Automation & tooling
- P1061Release automation commands
- P1060Five rules for credential automation
- P1058Scaffolding a new service from a template
- P1057Four numbers for automation
- P1056Idempotent scripts and safe re-runs
- P1055Cron to systemd timer: the migration path
- P1054Five signs your automation is fragile
- P1053Designing a CLI people keep using
Open in the notes app: search, filters, copy This note on GitHub