FullStack AI Hub
Studio
System Design · 05. Reliability
9 min
9 steps
Beginner

Observability & Alerting

Connect the Four Golden Signals, structured logs, distributed trace context, SLO error budgets, and multi-window burn-rate alerts.

System Design05. ReliabilityLesson 4 of 4
9 minBeginner9 steps

Observability & Alerting

Connect the Four Golden Signals, structured logs, distributed trace context, SLO error budgets, and multi-window burn-rate alerts.

MTTD
42 min (tweet!)
SILENT 500s
12.4%
VISIBILITY
Ping only
CHECKOUT
2,200/s
unobserved!2,200/sCheckout API54%ping: OK?Payment Svc94%12% silent 500
user traffic + trace ID
metrics / logs / spans
SLO burn check
silent error / alert fire
In This LessonStep 1 of 9
What You Will Master
  • ✓Monitor every service with the Four Golden Signals: Latency, Traffic, Errors, and Saturation
  • ✓Correlate structured logs and distributed trace spans across microservices using a Trace ID
  • ✓Define customer-centric SLIs, SLOs, and Error Budgets instead of paging on noisy raw CPU spikes
  • ✓Eliminate alert fatigue with multi-window SLO burn-rate alerts and decoupled telemetry collectors

Architectural Trade-Off Comparison Matrix

PatternBest ForKey Trade-Off
Metrics (Golden Signals)Cheap real-time dashboards, P99 histograms, and SLO alertingExplodes memory if you put unbounded high-cardinality user_id labels in metrics
Structured Logs (JSON)Detailed error payloads and forensic debugging for specific failuresExpensive to index at 100% volume—sample debug logs in prod
Distributed TracesPinpointing which single hop caused a slow microservice requestRequires propagating W3C traceparent headers across HTTP/queues + tail sampling
SLO Burn-Rate AlertsPaging on-call ONLY when real users are losing error budget fastRequires defining accurate SLIs before turning off legacy CPU pages

Step-by-Step Architectural Breakdown (9 Steps)

Full architectural walkthrough transcript and state transitions for Observability & Alerting.

STEP 01 · PROBLEMJump to step →

Flying blind: customers tweet before you even know

Your checkout error rate silently climbed to **12%** twenty minutes ago because a payment webhook timed out. Yet your only monitoring checks `"is the VM alive?"`—so all green pings say **UP** while angry users flood social media!

Without telemetry separating **symptoms** (user-facing errors & latency) from **causes** (CPU, locks, bad deploys), Mean Time to Detect (**MTTD**) stretches to hours.

watch:Host-up pings miss 90% of real production incidents—a server can answer ping in 1 ms while returning HTTP 500 to every shopper.

Mean Time to Detect (MTTD)Silent DegradationObservability Gap
STEP 02 · SOLUTIONJump to step →

Instrument the Four Golden Signals

Google SRE’s **Four Golden Signals** capture the health of any user-facing service in four metrics: **Latency** (P50/P95/P99), **Traffic** (RPS), **Errors** (5xx rate), and **Saturation** (CPU/queue/memory fullness).

Every API emits lightweight counters & histograms to a decoupled **OTel Collector → Prometheus** pipeline so engineers spot anomalies in **< 30 seconds**.

good:Always separate Latency of successful requests from Latency of failed requests—a fast 2 ms HTTP 500 error can make overall latency look artificially great!

Four Golden SignalsOpenTelemetry (OTel)Histogram Percentiles
STEP 03 · TECHNIQUEJump to step →

Structured JSON logs with correlation IDs

Plain-text logs like `"Error processing order"` are useless at 5,000 req/s—regex parsing breaks and you cannot group failures by merchant or error code. **Structured JSON logs** emit machine-parseable key-value fields (`order_id`, `trace_id`, `status`, `latency_ms`) directly to a centralized **Log Shipper**.

Every log line carries the request’s **Correlation / Trace ID**, letting engineers filter one broken checkout across 40 containers in a single query instead of SSHing into hosts!

good:Log **wide canonical events** (one rich JSON line per request at completion) instead of 20 noisy `INFO` debug lines per request—cutting log storage bills by 5×!

Structured JSON LoggingCanonical Wide EventsCorrelation IDs
STEP 04 · TECHNIQUEJump to step →

Distributed Tracing: follow one Trace ID across every hop

Metrics tell you *that* checkout P99 jumped to 900 ms—but across 6 microservices, **which hop** caused it? **Distributed Tracing** attaches a unique **`traceparent` Trace ID** at the Edge Gateway and propagates it on every HTTP/queue hop.

Each service records a timed **Span** (`span_id`, `parent_id`, `duration_ms`), assembling a waterfall flamegraph that exposes the exact slow SQL query in seconds!

good:Include `trace_id` inside every structured JSON log line too—letting you jump straight from a slow span into its exact exception log.

Distributed TracingW3C TraceContext (traceparent)Span Waterfall
STEP 05 · TRADE-OFFJump to step →

Taming telemetry costs: Tail Sampling & Cardinality

Storing 100% of traces and debug logs at 10,000 req/s can cost **more than your production servers**! Even worse, adding unbounded labels like `user_id` into Prometheus metrics creates **millions of time series** and crashes your TSDB (**Cardinality Explosion**).

**Tail-Based Sampling** buffers spans briefly in the Collector, keeping **100% of errors and slow P99 traces** while sampling only **5%** of fast 200 OK requests—cutting bills by **90%** without losing a single bug!

watch:Never put user_id, request_id, or email as a metric label—keep metrics low-cardinality (service, route, status) and put user_id in logs/traces.

High-Cardinality ExplosionTail-Based SamplingTelemetry Cost Control
STEP 06 · TECHNIQUEJump to step →

SLIs, SLOs, and Error Budgets align product & reliability

100% reliability is impossible and counterproductive. Instead, define a user-centric **SLI** (*"% of checkouts completing in < 300 ms with 2xx"*) and set an **SLO target** like **99.9% over 30 days**.

The remaining **0.1% (43.2 minutes/month)** is your **Error Budget**. While budget remains, teams ship features fast; if a buggy deploy burns the budget, feature launches pause to invest in reliability!

idea:99.9% = 43.2 min downtime/month; 99.95% = 21.6 min; 99.99% = 4.32 min. Each extra "nine" costs roughly 10× more engineering effort!

SLI (Indicator)SLO (Objective)Error Budget
STEP 07 · PROBLEMJump to step →

Why raw CPU alerts cause 3 AM Alert Fatigue

Paging on-call engineers every time `"Server CPU > 80% for 2 minutes"` sounds proactive—until a harmless nightly backup job wakes your team up **14 times a week** while users experience **zero errors**!

Fatigued engineers start muting Slack channels and ignoring pages—so when a real checkout outage finally hits, nobody responds in time.

watch:Page humans ONLY on user-facing symptoms (errors, latency, fast SLO burn)—never on raw CPU or disk graphs alone; use those as dashboards to debug!

Alert FatigueSymptom vs Cause AlertingActionable Pages
STEP 08 · SOLUTIONJump to step →

Multi-Window SLO Burn-Rate Alerting

Instead of noisy CPU thresholds, alert on **SLO Burn Rate**: how fast you are consuming your 30-day error budget. A **14.4× burn rate** eats 2% of your entire monthly budget in just **1 hour** → page on-call immediately!

Pair a **short confirmation window (5 min)** with the **long window (1 hour)**: the page fires fast when an outage begins AND **auto-resolves in 5 minutes** once fixed instead of staying noisy for an hour.

good:Fast burn (14.4× over 1h + 5m) → Page on-call immediately. Slow burn (2× over 24h) → Create a daytime ticket instead of waking someone at 3 AM!

SLO Burn RateMulti-Window AlertingPage vs Ticket Routing
STEP 09 · RECAPJump to step →

Production observability & SLO pipeline recap

Great observability turns 3 AM guesswork into calm, 2-minute root-cause diagnosis: emit the **Four Golden Signals**, propagate **W3C Trace IDs** into logs & spans, cut telemetry bills 90% with **Tail Sampling**, and page strictly on **Multi-Window SLO Burn Rates**.

Run the combined telemetry chaos test below to confirm your application stays 100% online even if the monitoring pipeline fails.

good:Decouple telemetry export asynchronously, keep metric labels low-cardinality, tail-sample noisy 200 OK spans, and page exclusively on user-impacting SLO burn.

Three Pillars UnifiedSLO-Driven AlertingDecoupled OTel Pipeline

Related Production Deep-Dives & Simulators

Included In Free Course
Free · Verifiable Credential

FS-102LLM Systems Foundations

Build a connected mental model from tokens through retrieval evaluation security and operations.

24 concepts~18h self-paced
Start Free Course
Weekly Engineering Dispatch

Get the weekly systems teardown

One technical note per week covering inference bottlenecks, retrieval harnesses, and commit-pinned teardowns.