Files
mtusi2026lab6/infra/runbooks/incident.md
T

3.0 KiB

Lab 6: local incident runbook

Use Grafana at http://localhost:3000 (dashboard Lab 6 · Messenger signals) or Prometheus rules at /alerts inside the Compose network. All times below are UTC. The dashboard uses stored Prometheus data; Tempo and Loki are separate datasources. Keep the last hour visible before diagnosing a recovered incident.

HTTP errors

Lab6HighHttpErrorRate fires when 5xx / all non-health HTTP requests exceeds 10% over 30 seconds for another 10 seconds. Client 4xx are in the denominator and have a separate panel; they are not server failures. Check HTTP RPS first: an empty or tiny denominator makes an error ratio unreliable. Compare 5xx ratio with DB pool used/waiting and up for the telemetry stores. In Tempo, find an HTTP server span in the time range and inspect its db.* child span duration/status. Query Loki {service_name="messenger-api"} for the same trace ID. A growing pool wait and failing DB span identify a database incident; a long server span with fast DB children points to the application path. Restart PostgreSQL only after confirming its container state and persistent volume. Confirm up, 5xx ratio, and /health/ready recover; record first pending, firing, and inactive timestamps from the rule API.

Queue lag

Lab6QueueLag fires when the oldest durable queued job exceeds 10 seconds for another 10 seconds. messenger_queue_depth counts rows with status='queued' in PostgreSQL, including an outbox row awaiting publication. It is sampled by the publisher. First compare queue depth, oldest age, messenger_worker_busy and messenger_worker_capacity. If busy disappears and capacity is absent, inspect the worker container; if capacity is present but processing outcome rates stop, inspect broker connectivity and job_published events in Loki. If jobs fail repeatedly, inspect messenger_jobs_processed_total grouped by outcome and the corresponding consumer trace; do not replay until the cause is corrected. Restart the worker, then verify queued count/age fall, ready durations appear, and the alert returns to inactive.

Follow an upload

Take the trace_id from the API attachment_uploaded log in Loki. Tempo should contain the API upload span, publisher attachments.publish producer span, worker attachments.process consumer span and its S3/render/DB children. The worker job_processed log has the same trace ID. Job identifiers are synthetic test identifiers; metric labels contain only route templates, status classes, job type/outcome and queue name. Never copy request bodies, tokens, signed object URLs or raw image bytes into evidence.

Missing telemetry

If a signal is absent, check Collector otelcol_exporter_queue_size, otelcol_exporter_send_failed_* and store up before concluding the business service recovered. The SDK uses asynchronous bounded queues and 2-second export timeouts; Collector queues are finite. Export loss during a backend outage is expected and must be reported. A missing sample is not zero errors. Telemetry stores are not part of API readiness.