STACK
Ch 17 · Observability, SRE & Performance
Chapter 17 · See it before users do

Observability, SRE & Performance — running prod calmly

17.1 · Pillars — three classic + two modern

PillarAnswers
Metrics"Is it healthy?"
Logs"What happened?"
Traces"Where did time go?"
Profiles"Why is CPU / heap hot?"
Events / state changes"What changed?" (deploys, flag flips, config) — overlaid on graphs.

17.2 · OpenTelemetry — the standard, finally

  • Vendor-neutral SDKs + collector + OTLP protocol for metrics, logs, traces.
  • Auto-instrumentation for most languages and frameworks.
  • GenAI semantic conventions (2025+) — standardised attributes for LLM spans.
  • Send to any backend (Datadog, Honeycomb, Tempo, Jaeger, Grafana Cloud, New Relic).

17.3 · Metrics — RED & USE

MethodForTracks
REDServicesRate · Errors · Duration
USEResourcesUtilisation · Saturation · Errors
The Four Golden SignalsGoogle SRELatency · Traffic · Errors · Saturation

17.4 · Logs

  • Structured JSON always; include trace_id, span_id, user_id, tenant_id, request_id.
  • Levels: debug / info / warn / error / fatal. error = "page someone".
  • Never log secrets / PII.
  • Centralise: Loki, Elastic/OpenSearch, Datadog Logs, Better Stack.

17.5 · Traces & spans

A trace is a tree of spans across services. Each span has IDs, timing, attributes. With OTel context propagation, one request shows up as one tree — the only sane way to debug distributed systems.

17.6 · Continuous profiling

Sample CPU / memory / lock contention in production continuously, attribute to functions. Pyroscope, Parca, Datadog Profiler. Catches the 1% slow path benchmarks miss.

17.7 · Wide events — the post-pillar idea

Honeycomb-style: one very wide event per request with hundreds of attributes; query / break down later. Replaces metrics + logs for many use cases.

17.8 · SLI / SLO / SLA / error budgets

TermDefinition
SLIService Level Indicator — measurable signal (success rate, p95 latency).
SLOTarget for an SLI over a window (99.9% / 30d).
SLACustomer contract with consequences.
Error budget1 − SLO. Spend it on shipping.
Burn rateRate of error-budget consumption.

17.9 · Alerts that don't suck

  1. Alert on symptoms users feel, not internals.
  2. Every alert links to a runbook.
  3. Multi-window, multi-burn-rate alerts (Google SRE workbook).
  4. Page only what needs action now. Everything else is a ticket.
  5. Review alert noise weekly; mute / merge / fix.

17.10 · Incident response

  1. Detect — alert or user.
  2. Triage — assign Incident Commander, Comms, Scribe.
  3. Mitigate — restore service first. Rollback > debug.
  4. Communicate — status page every 30 min.
  5. Resolve — confirm metrics back to normal.
  6. Postmortem — blameless, 5-whys, action items with owners.

17.11 · Performance engineering

  • Measure first — flamegraphs, perf, bpftrace, async-profiler, py-spy, Node Inspector.
  • Benchmark — k6 / wrk / Gatling for HTTP; cargo bench / JMH for code.
  • Profile in prod with continuous profilers.
  • Optimise the hot path — 90% of CPU is in 10% of the code.
  • Common wins: N+1 query → join / batch; sync I/O in loop → batch async; allocation in hot loop → pool / reuse; CPU-bound JSON → faster lib (orjson, simdjson); GC pauses → tune heap, generations.

17.12 · Chaos engineering

  • Inject failure (CPU pressure, network latency, pod kill, DNS slow) on purpose.
  • Tools: Litmus, Chaos Mesh, Gremlin, AWS FIS, Steadybit.
  • Always game-day in staging first; production chaos requires SLO budget & comms.

17.13 · The 2026 observability toolbox

ConcernPicks
Open-sourcePrometheus + Mimir + Loki + Tempo + Grafana + OTel Collector + Pyroscope
ManagedDatadog, New Relic, Grafana Cloud, Sumologic, Splunk, Dynatrace
Wide-events / next-genHoneycomb, Hyperdx
ErrorsSentry
RUM / frontendDatadog RUM, Sentry, Vercel Analytics
SyntheticCheckly, Datadog Synthetics, Better Stack
Incident managementPagerDuty, Opsgenie, incident.io, FireHydrant, Rootly
LLM-specificOpenLLMetry, LangFuse, LangSmith, Arize Phoenix

17.14 · Self-check

Q1 · Best alert pattern for catching SLO violations early without paging on blips?
Single threshold on average latency
Multi-window, multi-burn-rate
Alert on raw error counts only
Daily cron summary