Monitoring vs observability
Monitoring watches for known failure modes: "alert if error rate > 2%". Observability is the property of a system that lets you understand its internal state from its outputs, so you can debug problems you didn't anticipate: "why are checkouts slow only for UPI users on Android in Pune since 14:05?"
You need both. Monitoring wakes you up; observability gets you back to bed.
Three signals
| Signal | Answers | Cost | Example |
|---|---|---|---|
| Metrics | "Is something wrong? How much?" | Cheap, aggregated | p99 latency, error rate, queue lag |
| Logs | "What exactly happened in this event?" | Expensive at volume | Structured JSON with request_id, user_id, error |
| Traces | "Where did the time go across services?" | Sampled | Checkout took 2.1 s: 1.7 s in the inventory call |
Profiles (where CPU and memory go inside a process) are increasingly treated as a fourth signal.
Metrics: what to measure
RED for services (request-driven): Rate, Errors, Duration (latency percentiles). USE for resources (CPU, disks, pools, queues): Utilisation, Saturation (queueing), Errors. The four golden signals: latency, traffic, errors, saturation, a close cousin of RED + USE. Business metrics: orders per minute, payment success rate, messages delivered. These often catch problems that technical metrics miss (a bug that returns 200 OK with an empty cart).
Percentiles, not averages
An average latency of 120 ms can hide a p99 of 3 seconds. Always look at p50, p95 and p99 (and p99.9 for high-traffic services). Remember tail amplification: if a page makes 20 backend calls in parallel, the page is slow whenever any call is slow, so the page's median is close to the backends' p96.
Averaging percentiles. The average of ten hosts' p99 latencies is not the fleet's p99. Record latency as histograms and aggregate the buckets, then compute the percentile from the combined histogram (Case Study C25 of the book).
Cardinality
Every unique combination of label values is a separate time series. Labels like service, endpoint, status and region are fine. user_id, order_id or raw URLs with IDs in them create millions of series and can take down your metrics system. Put per-entity detail in logs and traces.
Logs that help
- Structured: JSON with consistent field names (
ts,level,service,trace_id,user_id,event,duration_ms), not free text. - Events, not chatter: log meaningful events (request completed, payment failed with reason), not every function entry.
- Levels used honestly: ERROR means someone should look; WARN means unusual but handled; INFO is the normal story; DEBUG is off in production by default.
- No secrets or raw personal data: redact tokens, passwords, card numbers and personal identifiers at the source and in the collector.
- Retention by value: hot, searchable logs for 7–14 days; cheaper archives for compliance.