Guide

Logs and traces tell stories about single requests. Metrics compress millions of those requests into numbers you can graph, alert on and compare across deploys. They are the cheapest way to know whether a service is healthy right now. Used badly, they become a wall of graphs nobody trusts and a pager nobody answers.

Good metrics work comes down to three choices: pick the right shape for each number, read it in a way that is correct across many instances, and page only when users are hurting.

Walking through the topic

Read the pages in this order. The first two cover the basics. The last four cover dashboards and alerts.

StepConceptWhat it answers
1Metric types and rateCounter, gauge, histogram or summary, and why counters become rates?
2Labels and cardinalityHow many series does one metric create, and which labels are too many?
3Histograms and fleet percentilesHow do I get a correct p99 across many pods?
4RED, USE and dashboardsWhat goes on a service dashboard, and in what order?
5Alerting on symptomsWhich signals should wake a human, and which should be a ticket?
6Alert fatigue and cleanupHow do I measure and prune noisy alerts?

The frameworks in one place

Three frameworks cover most services and hosts:

  • Golden signals (Google SRE): latency, traffic, errors and saturation. If you can graph only four things for a user-facing service, graph these.
  • RED for request-driven services: rate, errors and duration.
  • USE for resources: utilization, saturation and errors. It comes from Linux performance analysis.

RED is the top of the dashboard, and USE is the drill-down. Page on RED and SLO symptoms. Use USE to diagnose.

Common mistakes

  • Averaging percentiles across pods. The busiest pod should carry the most weight. Aggregate histogram buckets first.
  • Alerting on CPU or memory for a scaled service. Users did not page you to watch a gauge.
  • Adding labels for convenience. Each label multiplies the series count.
  • Treating dashboards as alerts. If it matters at 3 a.m., it needs a page with a runbook.

Key takeaways

  • Use counters for events, gauges for levels, and histograms for latency. Read counters as rates.
  • Never average percentiles. Sum the buckets, then take the quantile.
  • Keep label values bounded. Put user and request IDs in logs and traces.
  • Page on user symptoms with a runbook. Ticket everything else, and prune noisy alerts monthly.

Further learning

Google's SRE book chapter on monitoring defines the golden signals and the symptom-versus-cause split. Rob Ewaschuk's short doc is still the best guide to what deserves a page.

Monitoring Distributed Systems (Google SRE book)SRE management techniques | How Google scales team collaborations and management to ensure operational excellence across distributed teams.sre.google Prometheus: OverviewPrometheus project documentation for Overviewprometheus.io My Philosophy on AlertingMy Philosophy on Alerting based my observations while I was a Site Reliability Engineer at Google Author: Rob Ewaschuk <rob@infinitepigeons.org> Introduction Vernacular Monitor for your users Cause-based alerts are ba…Google Docs

Brian Brazil's short intro to scraping a machine with Prometheus and node_exporter is useful if you have never seen a live /metrics endpoint.

Monitoring a Machine with Prometheus: A Brief IntroductionRobust Perception