Observability
How to know what a running system does: logs, metrics and traces as different compressions of the same events; RED/USE; quantiles and histograms; correlation via trace IDs; label cardinality.
Three signals
You cannot page on vibes. Production systems emit more events than humans can read; observability is how you compress those events into something actionable without lying. Key idea. Logs, metrics and traces compress the same underlying events differently. Logs keep per-event detail (expensive to store and search at high RPS). Metrics keep a few numbers about all events (cheap for months, good for alerts and capacity). Traces keep one request's causal tree across services. Metrics say that something is wrong and how badly; traces say where in the graph; logs say what happened on that node; a shared trace ID (and often span IDs) links them so you do not grep by timestamp hope.
RED for request-serving services: Rate (requests/s), Errors (failed/s or ratio), Duration (latency distribution). USE for resources: Utilization, Saturation (queue depth, throttle), Errors. A disk at 40% utilisation with a full I/O queue is saturated; a CPU at 90% with no run-queue may still be fine. Instrument both views — RED for user pain, USE for the reason.
At 5 000 RPS, one log line per request at 500 bytes is ~2.5 MB/s (~216 GB/day) before indexing overhead. Sample debug logs; keep error logs; push the high-volume truth into metrics and sampled traces.
Quantiles and means
Means hide tails. A handler with mean 40 ms and p99 800 ms meets a "slow" user far more often than the mean suggests. Prefer an SLI like "fraction of requests under 300 ms" or histogram-backed quantiles. Client-side summary quantiles (each replica reporting its own p99) do not aggregate correctly across replicas — the "p99 of p99s" is not the fleet p99. Histograms with shared bucket boundaries merge correctly: sum counts per bucket, then estimate the quantile.
Percentiles of hops do not sum to the path percentile. If DNS, proxy and backend each advertise p99 = 20 ms, the end-to-end p99 can be much larger when the slow cases correlate — or occasionally smaller when they do not. Measure the path you promise in the SLO.
Exemplars (trace IDs attached to histogram buckets) close the loop: click a hot latency bucket, open a trace that landed there.
Cardinality
Each unique combination of metric name + label values creates a time series. User IDs, raw URLs, emails and unbounded error_message labels explode cardinality: millions of series, slow queries, surprise bills. Keep labels coarse (route template /users/:id, not /users/42891; status code; region; version). Put high-detail context in logs and traces, with sampling for happy paths and always-on for errors.
Worked cost sketch. 10 metrics × 50 endpoints × 20 pods × 5 status classes = 50 000 series — fine. Add a user_id label with 1 M users and you are in the tens of billions of potential series; the TSDB will fall over long before that fills. Budget series count like you budget egress.
Debug path that scales: alert on a RED metric → find a slow or error span in a trace → open logs filtered by that trace ID. Skipping to SSH on a random Pod is how you miss the replica that actually served the bad request.
What changed
| SSH into a box | Observability | |
|---|---|---|
| Scope | one machine, now | fleet, with history |
| Alerting | human noticing | SLI-based on metrics |
| Correlation | guess by clock | trace ID across services |
| Cost | engineer time | storage + cardinality discipline |
| Tail insight | local logs | histograms + exemplars |
SLIs should be defined on the metrics you actually collect — inventing an SLO on a signal that does not exist yet is how dashboards stay green while users complain. Start instrumentation at the edge (request count, error count, latency histogram) and push inward along the slow traces you find. Synthetic probes from outside the VPC catch DNS and certificate failures that in-cluster metrics never see.
Retention tiers save money without erasing history: high-resolution metrics for 15 days, downsampled for 180; raw traces sampled and short-lived; logs indexed hot then cold. Revisit cardinality quarterly — product launches love new labels and rarely delete them.
Naming conventions beat hero dashboards. Agree service_, _seconds histograms, and a short label allow-list in a platform doc; reject pull requests that invent latency_ms_p99 gauges you cannot aggregate. Consistency is what lets one burn-rate alert rule template cover a hundred services.
Trace sampling rates are an explicit trade: 1% of happy traffic plus 100% of errors is a common starting point at multi-kRPS. Raise sampling while debugging a release; lower it when the bill or the backend saturates. Never sample away the only evidence of a rare corruption bug without a complementary metric.
Next: SLOs, error budgets and alerting — turning these signals into objectives and pages that respect human sleep.
Check your understanding
The same questions as in Pulse. Answers are shared between modes.
Answers are saved on the server and tied to this browser until you sign in.