Skill: Observability and Runbooks
Defines the minimum observability a service needs before production and how
to keep it operable afterwards. Reference: engineering-principles.md §7
(Resilience) and §9 (Observability).
Structured logging
- Structured format (JSON or key=value) — logs are queried, not read.
- Correlation ID per request — generated at the edge, propagated to
every downstream call and log line.
- Levels with meaning:
ERROR = requires action; WARN = degraded but
self-healing; INFO = business-relevant events; DEBUG = off in prod.
- Never log secrets or PII — scrub
Authorization headers, passwords,
tokens, documents/IDs at the middleware level (see sec-secrets-management).
- Log the outcome of failures, not just the exception: what request,
which user (pseudonymized), what state.
Metrics — the four golden signals
Every service exposes at minimum:
| Signal |
Metric |
Typical alert |
| Latency |
p50/p95/p99 per endpoint |
p99 above SLO for 5 min |
| Traffic |
Requests/s |
Drop to ~0 (outage indicator) |
| Errors |
Error rate (5xx, business failures) |
Rate above baseline |
| Saturation |
CPU, memory, pool/queue usage |
Sustained > 80% |
Plus a health check endpoint (/health) that verifies real dependencies
(database ping, queue connectivity), monitored externally.
SLOs and alert hygiene
- Define 2–3 SLOs per service (e.g., "99.5% of requests under 500 ms",
"99.9% availability monthly") — alert on SLO burn, not raw spikes.
- Every alert must be actionable — if the response to an alert is
"ignore it", delete or tune the alert. Alert fatigue is an outage risk.
- Every alert links to its runbook.
Runbooks
One runbook per recurring operation or failure mode, created from the base
template templates/docs/runbook.template.md into docs/processo/runbooks/.
Minimum content per runbook:
- Symptom — what the operator sees (alert name, error pattern).
- Impact — who/what is affected.
- Diagnosis — exact commands/queries to confirm the cause.
- Mitigation — step-by-step, copy-pasteable, no decisions left implicit.
- Escalation — who to call when the steps don't work.
Update the runbook in the same PR as any change that alters the procedure.
After an incident, fold what was learned into the runbook and
docs/lessons-learned.md.
Tracing (when there is more than one service)
- Propagate trace context (W3C
traceparent) across HTTP/queue boundaries.
- Use OpenTelemetry-compatible instrumentation so the backend is swappable.
- Trace external calls and database queries — that is where latency hides.
Common mistakes
| Mistake |
Cause |
Solution |
| Logs unsearchable in incident |
Free-text logging |
Structured format + correlation ID |
| Alert storm during deploys |
Alerting on raw spikes |
Alert on SLO burn rates with windows |
| Health check always green |
Endpoint returns 200 unconditionally |
Verify real dependencies |
| Runbook outdated at 3 a.m. |
Procedure changed, doc didn't |
Runbook update in the same PR |
| PII in logs |
Logging whole request objects |
Allowlist fields; scrub at middleware |
1---2name: ops-observability3description: Use when adding logging, metrics, or tracing; defining SLOs and alerts; writing runbooks; or preparing a service for production operation. Structured logs, the four golden signals, alert hygiene, and runbook discipline.4---56# Skill: Observability and Runbooks78Defines the minimum observability a service needs before production and how9to keep it operable afterwards. Reference: `engineering-principles.md` §710(Resilience) and §9 (Observability).1112## Structured logging1314- **Structured format** (JSON or key=value) — logs are queried, not read.15- **Correlation ID per request** — generated at the edge, propagated to16 every downstream call and log line.17- **Levels with meaning:** `ERROR` = requires action; `WARN` = degraded but18 self-healing; `INFO` = business-relevant events; `DEBUG` = off in prod.19- **Never log secrets or PII** — scrub `Authorization` headers, passwords,20 tokens, documents/IDs at the middleware level (see `sec-secrets-management`).21- Log the **outcome of failures**, not just the exception: what request,22 which user (pseudonymized), what state.2324## Metrics — the four golden signals2526Every service exposes at minimum:2728| Signal | Metric | Typical alert |29|--------|--------|---------------|30| Latency | p50/p95/p99 per endpoint | p99 above SLO for 5 min |31| Traffic | Requests/s | Drop to ~0 (outage indicator) |32| Errors | Error rate (5xx, business failures) | Rate above baseline |33| Saturation | CPU, memory, pool/queue usage | Sustained > 80% |3435Plus a **health check endpoint** (`/health`) that verifies real dependencies36(database ping, queue connectivity), monitored externally.3738## SLOs and alert hygiene3940- Define 2–3 SLOs per service (e.g., "99.5% of requests under 500 ms",41 "99.9% availability monthly") — alert on SLO burn, not raw spikes.42- **Every alert must be actionable** — if the response to an alert is43 "ignore it", delete or tune the alert. Alert fatigue is an outage risk.44- Every alert links to its runbook.4546## Runbooks4748One runbook per recurring operation or failure mode, created from the base49template `templates/docs/runbook.template.md` into `docs/processo/runbooks/`.5051Minimum content per runbook:52531. **Symptom** — what the operator sees (alert name, error pattern).542. **Impact** — who/what is affected.553. **Diagnosis** — exact commands/queries to confirm the cause.564. **Mitigation** — step-by-step, copy-pasteable, no decisions left implicit.575. **Escalation** — who to call when the steps don't work.5859Update the runbook in the same PR as any change that alters the procedure.60After an incident, fold what was learned into the runbook and61`docs/lessons-learned.md`.6263## Tracing (when there is more than one service)6465- Propagate trace context (W3C `traceparent`) across HTTP/queue boundaries.66- Use OpenTelemetry-compatible instrumentation so the backend is swappable.67- Trace external calls and database queries — that is where latency hides.6869## Common mistakes7071| Mistake | Cause | Solution |72|---------|-------|----------|73| Logs unsearchable in incident | Free-text logging | Structured format + correlation ID |74| Alert storm during deploys | Alerting on raw spikes | Alert on SLO burn rates with windows |75| Health check always green | Endpoint returns 200 unconditionally | Verify real dependencies |76| Runbook outdated at 3 a.m. | Procedure changed, doc didn't | Runbook update in the same PR |77| PII in logs | Logging whole request objects | Allowlist fields; scrub at middleware |