Files
2026-11-06 17:30:30 +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.