Shelves / Observability and SRE
OB·106
Observability and Reliability Projects
Eight build-it-yourself projects that make the tiffin centre observable and reliable: full OpenTelemetry instrumentation, a telemetry pipeline you control, structured logging with a log platform, metrics with cardinality guardrails, tail-sampled tracing, SLOs with tested burn-rate alerts, an incident response practice with game days, and resilience plus performance engineering under fault and load, each with milestones, measurable definitions of done and stretch goals.
How to approach the projects
One observable, reliable system
The labs in this volume took one signal or pattern at a time. These projects join them up around the tiffin centre's services (orders, kitchen, payments, delivery, or your own services from Volumes 5–8), so that when something goes wrong you are told about it, you can see why, and the damage stays small. Use OpenTelemetry SDKs and the Collector, Prometheus (or Mimir), Grafana, a trace store (Jaeger or Tempo), a log store (Loki, OpenSearch or a ClickHouse-based one) and Alertmanager; all run on a laptop or a small Kubernetes cluster, and a managed observability vendor's free tier works equally well.
| # | Project | Main chapters | Roughly |
|---|---|---|---|
| 1 | Instrument everything with OpenTelemetry | Start Here, 97, 98 | 1 week |
| 2 | A telemetry pipeline you control | 98 | 1 week |
| 3 | Logging that answers questions | 99 | a weekend–1 week |
| 4 | Metrics with guardrails | 100 | 1 week |
| 5 | Tracing that keeps what matters | 101 | 1 week |
| 6 | SLOs with tested alerts | 102 | 1 week |
| 7 | Incident response you've practised | 103 | 1 week |
| 8 | Resilience and performance under fault and load | 104, 105 | 1–2 weeks |
New to the topic? Do them in order; each builds on the last. Experienced? Skim 1–3 and treat the stretch goals of 4–8 as the assignment.
The working method
- Telemetry as code: instrumentation, Collector configs, recording and alert rules, dashboards (as JSON or Grafonnet/Jsonnet) and runbooks live in Git and ship through CI.
- Write the definition of done first, as a query, a test (
promtool test rules), or a scripted experiment. - Break it on purpose: kill services, add latency, fill disks, leak cardinality, drop propagation headers. A project isn't done until you've watched it catch a failure you caused.
- Measure the cost of the telemetry itself: series, GB per day, CPU overhead, alert pages per week.
- Write a README per project with decisions, alternatives and measurements.
The eight projects
Project 1: instrument everything with OpenTelemetry
Goal. Every service emits traces, metrics and logs that share identifiers and resource attributes.
Milestones. Zero-code instrumentation for HTTP servers and clients, database drivers and messaging → manual spans and attributes for business steps (order.id as a span attribute, never a metric label) → resource attributes (service.name, service.version, deployment.environment.name) set from configuration → RED metrics per route → trace and span IDs in every log line → context propagated through a queue (Kafka or NATS headers) and an async worker.
Done when. For a request that crosses three services and a queue, one trace shows every hop; the request's log lines are found from the trace in one click; an exemplar on a latency panel opens a real slow trace; the instrumentation adds less than 5% p99 latency in a measured A/B run.
Stretch. Continuous profiling (Pyroscope or Parca) linked from spans; eBPF-based instrumentation (Grafana Beyla or OpenTelemetry eBPF) for a service you don't modify, compared with SDK instrumentation.
Project 2: a telemetry pipeline you control
Goal. All telemetry flows through Collectors you configure, so routing, privacy and cost are decided in one place.
Milestones. Agent Collectors (DaemonSet or sidecar) and a gateway tier → memory_limiter, batching, persistent sending queues (file_storage) → enrichment (Kubernetes attributes) → scrubbing: hash or drop PII, mask card-number and token patterns, with a test suite of "bad" spans and logs → routing to two backends (for example a self-hosted stack and a vendor trial) → dashboards for the Collector's own metrics (accepted, refused, dropped, queue size, export failures).
Done when. A backend outage of 5 minutes loses no telemetry (verified by counting); a deliberately leaked email address and card number never reach storage; a backend can be swapped by changing configuration only; alerts fire when the pipeline refuses or drops data.
Stretch. OpenTelemetry Transformation Language (OTTL) rules for cost reduction (dropping debug logs, aggregating noisy spans); a Collector built with the OpenTelemetry Collector Builder containing only the components you use.
Project 3: logging that answers questions
Goal. Structured, correlated, cheap logs that you can query in seconds.
Milestones. A shared logging library or configuration per language with JSON output, constant messages, semantic-convention field names and automatic trace context → canonical log lines per request → redaction at the source → collection with checkpoints and multiline handling → a log store with retention tiers (hot 7 days, archive 90+) → five saved queries that answer real questions ("errors by route and version since the last deploy", "slowest requests for tenant X").
Done when. Every service's logs parse with zero errors for a week (counted by the collector); log volume per request is measured and halved from its starting point without losing a question you rely on; a planted secret in a log line is caught by a CI test and by the pipeline.
Stretch. Log-based metrics for one business event; sampling of high-volume INFO logs while keeping all WARN/ERROR; an audit log stream with stricter retention and tamper evidence.
Project 4: metrics with guardrails
Goal. Useful metrics whose cost can't run away.
Milestones. RED metrics for services and USE metrics for hosts, databases and queues → histograms with buckets chosen around your SLO thresholds (or native histograms) → recording rules for expensive queries → dashboards per service following one layout (traffic, errors, latency, saturation) → cardinality controls: sample_limit per job, relabelling rules that drop known-dangerous labels, and a weekly report of the top 20 metrics by series → long-term storage (Mimir, Thanos or a managed service) with downsampling.
Done when. A deploy that adds a user_id label is caught (by a CI check or by sample_limit) before it adds more than 10,000 series; dashboards load in under 2 s; every percentile on a dashboard is computed from aggregated histograms, not averaged.
Stretch. Per-team cardinality budgets with cost attribution; an adaptive-metrics approach that drops unused series automatically.
Project 5: tracing that keeps what matters
Goal. Every error and slow request traced, at a fraction of the cost of keeping everything.
Milestones. Span metrics generated before sampling → a tail-sampling gateway tier behind the loadbalancing exporter (routing by trace ID) → policies: all errors, all requests above the SLO latency threshold, everything for a debug header, a small probabilistic baseline, rate limits per service → a check for broken propagation (orphan SERVER spans, CLIENT spans with no child) → trace-based analytics: compare slow and fast traces by attribute.
Done when. Over a day of load with injected failures, 100% of error traces and slow traces are kept, at least 85% of normal traces are dropped, kept traces are complete across services, and the broken-propagation check catches a header deliberately removed in a proxy.
Stretch. Span links for batch consumers; a service dependency map built from span metrics; trace-based tests that assert on a trace's shape in CI.
Project 6: SLOs with tested alerts
Goal. User-centred SLOs that drive paging and planning.
Milestones. Choose two or three user journeys (place an order, track a delivery) → SLIs as good/valid events for availability and latency → SLOs agreed with a "product owner" (a friend will do), with an error budget policy written down → multi-window, multi-burn-rate alerts generated by Sloth or Pyrra, or written by hand → promtool test rules suites for an outage, a slow burn, a blip and a quiet night → an SLO dashboard with budget remaining.
Done when. The alert tests pass in CI; a staged 10% error outage pages within 10 minutes; a 10-minute blip doesn't page; a week of normal traffic produces zero pages; the error budget policy has been applied once (for example, a freeze rehearsal).
Stretch. A composite SLO for a journey across three services; SLOs for a batch pipeline (freshness) and a queue consumer (lag); an OpenSLO specification exported to two tools.
Project 7: incident response you've practised
Goal. When something breaks, the right person is told once, knows what to do, and the organisation learns.
Milestones. Alertmanager (or an incident platform) with routing by severity and team, grouping, inhibition rules for known dependencies, and silences with authors and expiry → a runbook for every paging alert, linked from the alert → an on-call schedule with escalation (a free tier of an on-call tool, or a webhook to a chat channel) → an incident process: severities, roles (incident commander, communications, operations), a status-page template → two game days with written timelines → a blameless postmortem with tracked action items.
Done when. In a game day, time to detect and time to mitigate are measured from telemetry and both improve between the first and second game day; a dependency failure produces one page, not one per dependent service; every action item from the postmortem has an owner and a date, and at least one is done.
Stretch. Chaos experiments on a schedule (Chaos Mesh or LitmusChaos) with automatic abort on SLO burn; incident metrics (count by severity, time to mitigate distribution) reported monthly.
Project 8: resilience and performance under fault and load
Goal. Services that stay fast under expected load and degrade gracefully under faults and overload.
Milestones. Timeouts and deadline propagation on every remote call → retries at one layer only, with exponential backoff, full jitter and a retry budget → circuit breakers and bulkheads per dependency, with fallbacks (cached menu, "kitchen busy, try in a minute") → load shedding with a concurrency limit and priority for checkout traffic → an open-model load test (k6 constant-arrival-rate, wrk2 or Gatling) that measures latency against utilisation and finds each service's capacity at its SLO latency → profiles for the two hottest endpoints and one optimisation with a measured gain → a capacity plan with headroom and N+1.
Done when. With kitchen hanging, the menu and tracking pages keep their SLOs; at 150% of capacity, goodput stays above 90% of capacity and accepted requests stay within their deadline; a retry storm can't exceed 110% of normal traffic at the dependency; the capacity plan predicts the measured breaking point within 20%.
Stretch. Cell-based isolation with shuffle sharding for tenants; a disaster-recovery exercise that restores a database from backup and measures RPO and RTO against targets; a performance regression gate in CI.
Tracking your progress
Portfolio checklist
Keep the instrumentation, Collector configs, rules with their tests, dashboards, runbooks, game-day timelines and postmortems in Git, with a README per project. Observability and reliability evidence is numbers about failures you caused and caught: "every request traced across 4 services and a queue; 0 PII in storage across 1,000 planted samples; series capped at 50k per job; 100% of error traces kept at 12% storage; 10% outage paged in 9 min, zero false pages in 7 days; dependency failure → 1 page; game-day time to mitigate 14 → 4 min; goodput 94% at 150% load" is what makes the portfolio credible.
Mapping to mastery levels
Completing projects 1–3 with their checks puts you at L2 across the volume. Doing their stretch goals and explaining every mechanism is L3–L4. Designing and defending projects 4–8 (pipeline topology, cardinality governance, sampling strategy, SLOs and budget policy, incident process, resilience architecture and capacity plans) is L5 work, the level SRE and platform interviews probe.