Learn Labs
Beyond Metrics

Capstone Project

Monitor the whole repo, end to end

The capstone turns this module into the monitoring platform for the whole repo. Each milestone builds on the lab stack in prometheus/compose_prod.yaml and should end committed to git, with config validated by the CI checks from Operating Prometheus.

Milestone 1: every module monitored

  • Postgres: run ../postgres and make sure postgres-exporter reaches it (pg_up == 1). Create a dedicated exporter role with pg_monitor and switch the DSN to it.
  • ClickHouse: enable the built-in endpoint with config/clickhouse/prometheus.xml. Build a ClickHouse Overview dashboard: queries per second, query duration, inserted rows, parts per table, merges, memory.
  • For every other module (Redis, Kafka, RabbitMQ, SeaweedFS, Nginx, Kubernetes): each already ships an exporter or native endpoint, a dashboard and alerts. Extend one: add the alert you wish it had, with a rule test.

Done when: up is 1 for every job, and every component has a provisioned dashboard.

Milestone 2: one overview

Build a Repo Overview dashboard that answers "is anything unhealthy?" in one screen:

  • one row per component: up/down, a key saturation signal, error rate
  • links from each row to that component's dashboard, carrying the time range
  • firing alerts, from the Alertmanager data source
  • a deploy annotation from changes(app_build_info[1m]) > 0

Done when: a friend who has never seen the repo can find a broken component in 10 seconds.

Milestone 3: SLOs for the demo app

  • Availability SLO (already in place) and a latency SLO: 99% of /api/orders under 100 ms, measured as a bucket ratio.
  • Recording rules for both at 5m, 30m, 1h, 2h, 6h, 1d.
  • Fast and slow burn alerts for both, each with a runbook_url.
  • promtool unit tests covering each alert firing and not firing.
  • An error-budget-remaining stat panel.

Done when: promtool test rules passes, and a chaos run with extra_latency_ms=200 fires the latency fast-burn alert and nothing else.

Milestone 4: production hardening

  • Basic auth on Prometheus and Alertmanager via --web.config.file, with Grafana's data sources updated to match.
  • sample_limit on every scrape job.
  • Alerts for config reload failures, rule failures, notification failures, series growth, and Prometheus memory.
  • The Watchdog routed to an external heartbeat service (a free Healthchecks.io check works).
  • An age alert and an absent() alert for the nightly batch job.
  • A check.sh that runs every validation; wire it into a git pre-commit hook or CI.

Done when: the game day from Failure Scenarios catches every scenario with an alert, including scenario 7.

Milestone 5: logs and traces

  • Add Loki + Alloy and ship every container's logs.
  • Add Tempo and instrument the demo app with OpenTelemetry.
  • Enable exemplars, and link Prometheus → Tempo → Loki in the data source provisioning.

Done when: from a latency spike on the RED dashboard, you can click through to a slow trace and then to its logs.

Stretch goals

  • Long-term storage: with the SeaweedFS module as the bucket, add a Thanos sidecar, store gateway, and querier, as sketched in Long-Term Storage.
  • HA pair: a second Prometheus replica and a 3-node Alertmanager cluster; prove alerts are deduplicated.
  • Kubernetes: run the whole stack on a local kind cluster with the Prometheus Operator, converting scrape configs into ServiceMonitors.

On this page