Files
mtusi2026lab7/infra/runbooks/db-availability.md
T
Vladislav Kunetskiy 1b6e96ccc0
Application / Go invariants and static checks (pull_request) Canceled after 0s
Application / Lab7 verified TLS and retained features (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s
lab7: безопасность, mTLS, OpenBao и PKI lifecycle
2026-11-10 14:39:57 +03:00

9 lines
1.0 KiB
Markdown

# PostgreSQL slow/unavailable
1. Edge SLI first: HAProxy may return 503/504 while API replicas are removed by `/health/ready`; API-side 5xx can therefore be near zero. Use the HAProxy panel and `up{job="haproxy"}`.
2. `docker compose ps postgres`; `docker compose logs --tail=100 postgres`; `pg_isready` from a replica.
3. Prometheus: `messenger_db_pool_used/idle/max`, `messenger_db_pool_empty_acquire_total`, `rate(...wait_seconds)`; API/worker DB spans in Tempo (`SELECT`/`INSERT`/`UPDATE`/`BEGIN`/`COMMIT`, `pool.acquire`) show failures/latency.
4. Loki: `{service_name=~"messenger-api|messenger-worker"} | severity_text="error" | trace_id="<id>"`. A handler span with a long DB child span is a DB problem; a long handler without a DB child is an application problem.
5. If PostgreSQL was stopped, start it, wait for health, then let the pool reconnect. Worker deliveries are requeued; verify no accepted job is lost (jobs accepted/ready/failed counts).
6. Confirm the alert resolved; record injection/restore and first successful request timestamps.