lab7: безопасность, mTLS, OpenBao и PKI lifecycle
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
# API error / availability SLI
|
||||
|
||||
1. Grafana → Lab6 → API overview. Check `slo:api_error_ratio:5m` and the edge panel; 5xx at HAProxy is the SLI, API-side 5xx is diagnostic.
|
||||
2. Prometheus → Status → Targets: `haproxy`, `otel-collector`, `rabbitmq` must be UP. If HAProxy is DOWN, no edge SLI exists; inspect `docker compose ps lb`.
|
||||
3. HAProxy stats `http://127.0.0.1:8404/stats`: look for DOWN replicas and `check` errors. A stale `X-Instance-Id` is the stopped replica.
|
||||
4. If all replicas are DOWN, check `/health/ready` of one replica (5xx means DB/S3 dependency) and PostgreSQL logs.
|
||||
5. For a slow handler, open a Tempo trace from the error panel; DB child span (`SELECT`/`INSERT`/`UPDATE`/`BEGIN`/`COMMIT`) duration vs HTTP span shows whether PostgreSQL or the handler is slow. Correlate `trace_id` in Loki.
|
||||
6. Recover DB/S3, wait for HAProxy `rise 2`, then verify a 2xx through the LB and resolved alert.
|
||||
@@ -0,0 +1,8 @@
|
||||
# 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.
|
||||
@@ -0,0 +1,8 @@
|
||||
# Queue lag / time-to-ready
|
||||
|
||||
1. Grafana → Lab6 → Jobs and queue: `messenger_queue_oldest_job_age_seconds`, `rabbitmq_queue_messages_ready`, `messenger_worker_busy/capacity`, TTR p95.
|
||||
2. If oldest age grows and `worker_busy == capacity`, the worker is saturated: inspect `worker` logs (`job claimed`, `job retry scheduled`) and `WORKER_CONCURRENCY`.
|
||||
3. If queue depth grows but `worker_busy == 0`, the worker is stopped or cannot connect to the broker: `docker compose ps worker`, worker `/health/ready`, broker `rabbitmqctl list_queues`.
|
||||
4. If retries grow, filter Loki `{service_name="messenger-worker"} | severity_text="error"` and trace `job.process` attempts; check `error_code`.
|
||||
5. For a lost delivery, relay logs `outbox publish cycle` / `lost queued jobs reconciled` and `jobctl failed`.
|
||||
6. Restore worker/broker, verify queue depth < 5 and oldest age < 5s for two scrapes, then confirm the alert resolved.
|
||||
@@ -0,0 +1,15 @@
|
||||
# SLO burn-rate
|
||||
|
||||
1. Open Grafana → Lab6 → API overview and Jobs and queue.
|
||||
2. Check `slo:api_error_ratio:1h` + `5m` for fast burn, `6h` + `30m`
|
||||
for slow burn; TTR uses `slo:job_ttr_bad_ratio:*`.
|
||||
3. Fast page means the current hour is consuming the 7-day error budget at
|
||||
≥14.4×. Confirm edge traffic in HAProxy (`proxy="api_backend"`), then inspect
|
||||
API traces for 5xx and DB spans (`SELECT`/`INSERT`/`UPDATE`/`BEGIN`/`COMMIT`)
|
||||
or missing worker `job.process` spans.
|
||||
4. Slow ticket means a sustained 6-hour burn. It can fire with a low current
|
||||
rate; do not suppress it until the 30m window is below 3% (API) or 6% (TTR).
|
||||
5. Resolve only after the SLO ratio stays below the fast/slow thresholds and
|
||||
the underlying dependency (worker, PostgreSQL, broker) is healthy.
|
||||
6. Record injection/restore UTC and the first firing/resolved timestamps in
|
||||
`evidence/lab6/track2/`.
|
||||
@@ -0,0 +1,8 @@
|
||||
# Telemetry backend down
|
||||
|
||||
1. This is an observability incident, not a business outage. First verify API: `curl -fsS http://127.0.0.1:8080/health/ready` and a smoke request.
|
||||
2. `docker compose ps otel-collector prometheus loki tempo grafana`.
|
||||
3. If Tempo/Loki is down, Collector exporter queues fill; inspect `otelcol_exporter_queue_size`, `otelcol_exporter_send_failed_*`, `otelcol_processor_refused_*`. Queues are bounded by `sizer: bytes`; the Collector does not grow without limit.
|
||||
4. If the Collector is down, Prometheus `up{job="otel-collector"}=0`; the application continues to accept work. Application OTLP export failures are best-effort and do not affect `/health/ready`.
|
||||
5. Restart the failed backend/collector; confirm `up`, queue drains, and no new refused records. Lost telemetry is bounded and documented; business data in PostgreSQL/S3 is unaffected.
|
||||
6. Do not stop Prometheus while diagnosing another alert: without Prometheus there is no rule evaluation. Use HAProxy stats and container logs as fallback.
|
||||
Reference in New Issue
Block a user