Files
mtusi2026lab7/infra/runbooks/db-availability.md
T
Vladislav Kunetskiy 3d216fbd50 База lab7: контракт 1.7.0 и реализация lab1–lab6
Перенесены cmd/internal/config, compose.yaml, Dockerfile, скрипты, student-tests и evidence из mtusi-messenger (master, lab6). Skeleton lab7 (openapi/infrastructure 1.7.0, trust-matrix.md, security/THREAT_MODEL.md, infra/openbao, tests/security.py) сохранён; make test-security добавлен в Makefile.
2026-11-09 13:03:49 +03:00

1.0 KiB

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.