Skip to content

Part 5 · Observability

Your service is now running in Kubernetes, scaling under load — and completely opaque. When a user says “the editor was slow at 2 p.m.,” you have no way to answer why. Part 5 fixes that. Observability is the discipline of making a running system explain itself, and it rests on three pillars: logs (what happened), metrics (how much, how fast, aggregated), and traces (the path of one request through every service). Rust’s tracing ecosystem gives you all three from one instrumentation.

request ─►[ span: http ]─►[ span: db ]─►[ span: claude ]─►[ span: cache ]
│ │ │ │
▼ ▼ ▼ ▼
logs ── structured JSON lines (level, target, fields, trace_id)
metrics ─ /metrics → Prometheus → Grafana dashboards
traces ── OpenTelemetry → one waterfall per request, across services
  • Structured logging with tracing: not println!, but events with fields, levels, and a span per request that carries context (method, path, user, trace_id) into every log line beneath it.
  • Metrics: a Prometheus /metrics endpoint exposing the four golden signals — latency, traffic, errors, saturation — plus quill-specific counters (posts created, tokens generated, cache hits).
  • Distributed tracing: propagate a trace id from the Astro frontend through the web binary, the worker, Postgres, Redis, and the Claude call, so one slow request is one readable waterfall.
PillarQuestion it answersquill example
LogsWhat happened, exactly?“post 42 update failed: unique_violation on slug”
MetricsHow much, how fast, right now?p99 latency of POST /draft over the last hour
TracesWhere did this one request spend its time?1.9 s draft = 40 ms db + 1.8 s Claude + 60 ms render
ChTitleYou addThe idea it teaches
1Structured loggingtracing + spans, JSON outputevents vs prints, spans as context, log levels that mean something
2Metrics/metrics, golden signals, Grafanacounters/gauges/histograms, RED/USE, what to actually chart
3Distributed tracingOpenTelemetry, trace propagationone request across services, finding the slow hop

Once it compiles, what does it take to run for real users? Part 5’s answer: the system has to be able to tell you when it’s unhealthy — before a user does. Observability is what turns “it’s slow, I guess?” into “the p99 of the draft endpoint tripled at 14:03 and every slow request spent its time in the Claude call, which correlates with a rate-limit retry storm.” That’s the difference between guessing and operating.

Next: Part 6 · Make It Fast →