Skip to main content
Metrics & Monitoringlesson 4 of 4 · 2 min read

Dashboards That Help at 3am

The stack

The standard stack scrapes a metrics endpoint on each of your services every fifteen seconds or so, renders dashboards from that store, and routes alert rules to your pager.

Notice why pulling beats pushing here, which sounds backwards until you operate it. Your collector knows immediately when a target stops answering, which turns the service is silently gone into an alertable fact instead of an absence of data you notice too late.

Design for the person who was woken

Design your dashboard for its actual audience: an engineer woken by a page, running at maybe 40 percent, who did not write this service.

Structure it top down for that person. First row, is the service serving users, with error rate and latency percentiles against their targets. Second row, the four golden signals with deploy markers drawn over them, because a startling number of incidents line up with a deploy and the overlay answers that instantly.

Below that, saturation of every hard dependency: database, cache, queue, connection pools. Push the resource minutiae onto a separate drill-down page.

Follow a few rules that keep dashboards honest. Link every alert to the dashboard that puts it in context, so nobody hunts for graphs mid-incident.

Keep your colours and units consistent, seconds everywhere or milliseconds everywhere, because a brain at 3am will misread a mixed axis.

Curate a handful of dashboards instead of maintaining a graveyard of 200 personal ones. A stale dashboard does not merely fail to help. It actively misleads.

Put the on-call runbook link in the header while you are there.

Judge the result by the right test. Not how impressive it looks on the office television, but how many seconds it takes a stranger to answer whether this service is okay and, if not, what changed.

the shape of it
Service A/metricsService B/metricsPrometheusscrape every 15sGrafanadashboardsAlertmanagerPagerDutyon-call phonepullpullfiring rulespagePromQL
step 1 of 3
Prometheus pulls metrics from each service, Grafana visualizes them, and Alertmanager routes firing rules to the on-call.

Worked example

After a messy incident where the on-call spent 25 minutes hunting through 14 dashboards, Farah's platform team at a travel booking site standardizes one layout for all 30 services: SLO row on top, golden signals with deploy markers second, dependency saturation third, links to runbook and drill-downs in the header. Grafana provisions the dashboards from a template in git, so every service gets the layout for free and drift is a code review problem. Three weeks later a 02:50 page hits a service the on-call has never touched. The top row shows errors breaching SLO, the deploy marker shows nothing shipped in 6 hours, and the dependency row shows the cache connections saturated. He restarts the leaking consumer per the linked runbook. Time from page to mitigation: 11 minutes, on a service he had never opened before.

Metrics & Monitoring: wrapping up

In the real world

  • 01Prometheus was built at SoundCloud in 2012 by ex-Googlers modeling it on Google's internal Borgmon, and became the second project to graduate from the CNCF after Kubernetes.
  • 02The four golden signals come from Google's 2016 SRE book, which also argues that averaging latency hides the tail and that SLOs should target percentiles.
  • 03Netflix built Atlas, its in-house dimensional time-series system, to handle billions of distinct metrics with near-real-time queries for its operations teams.
  • 04Jeff Dean and Luiz Barroso's paper The Tail at Scale describes how Google uses hedged requests to cut fan-out tail latency, sending a duplicate request when the first exceeds the p95.
  • 05Datadog bills custom metrics by distinct time series, which turns label cardinality from a technical concern into a budget line that platform teams actively police.

Questions people ask

When should something be a metric versus a log?

Metrics answer aggregate questions cheaply: rates, percentiles, saturation over time, things you alert on. Logs answer specific questions about individual events. The boundary is cardinality: if you want to slice by something with thousands of values, like user or merchant, that belongs in logs or traces, because each distinct label value in a metric becomes a stored time series.

Why does everyone say to alert on p99 instead of the average?

Because averages hide the tail where real pain concentrates. A handful of multi-second requests barely move an average over millions of fast ones, yet at scale that handful is thousands of affected users, biased toward your heaviest users because they make the most requests. Percentiles state directly what fraction of requests exceeded a threshold.

Pull-based scraping seems odd. Why not have services push metrics?

Pull gives you a built-in liveness check, since a failed scrape is an immediate, alertable signal that the target is gone, and it lets you run the same setup in dev by pointing Prometheus at an endpoint. Push fits short-lived batch jobs and heavily firewalled environments, which is why Prometheus offers a push gateway for exactly those cases.

Quick review

Four Golden Signals (Google SRE):
Latency (how slow), Traffic (how much), Errors (how broken), Saturation (how full)
RED method for services:
Rate (req/sec), Errors (error rate %), Duration (latency distribution)
USE method for infrastructure:
Utilization (% used), Saturation (queue depth), Errors (hardware/soft errors)
Histogram vs counter vs gauge:
use histograms for latency (gives p50/p95/p99), counters for rates, gauges for current value
Prometheus:
pull-based scraping. metric{label=value} syntax. AlertManager for routing alerts
Grafana:
dashboards on top of Prometheus, CloudWatch, Datadog. Alert on metric thresholds
Cardinality explosion:
high-cardinality labels (user_id, request_id) can OOM Prometheus. Keep label cardinality low
the trade-off

High-cardinality metrics are expensive. Design your metric labels carefully. Changing them later is painful.

in the room

Capacity planning. SLA compliance verification. Catching degradation before users notice.