forked from mtusi2026/mtusi2026lab6
Лаба 6: OpenTelemetry + Grafana наблюдаемость (оценка 4)
Переиспользован стек lab5. API/worker шлют OTLP (traces/metrics/logs) в otel-collector -> Prometheus/Loki/Tempo; Grafana с provisioning датасорсов, дашборда и alert rules в Git. W3C trace context переносится через поле traceparent в задании очереди (API producer span -> worker consumer span в одном trace, подтверждено прямым запросом к Tempo). Три контролируемых инцидента прогнаны и задокументированы (worker down -> queue lag + alert, DB down отличим от медленного handler по error-span, telemetry backend down не роняет API/Collector). В процессе найдены и исправлены 4 реальных бага (middleware после старта приложения, detached span context, замерзающая метрика очереди при падении её единственного источника, неатомарный XACK+XDEL) — см. REPORT.md и evidence/. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
=== Incident 2: PostgreSQL unavailable ===
|
||||
baseline (DB up):
|
||||
http_code=200 time=0.005956s
|
||||
--- postgres stopped ---
|
||||
http_code=500 time=0.013984s
|
||||
request body: {"error":{"code":"internal_error","message":"internal error","request_id":"8e7690fe8fcf47108c547d49a2dd108f"}}
|
||||
X-Request-Id: 8e7690fe8fcf47108c547d49a2dd108f
|
||||
|
||||
trace_id (from Loki log correlation): 0f8359335fabe9574a08406208226a5f
|
||||
Span breakdown from Tempo:
|
||||
GET /api/v1/users/me duration=10.7ms status=ERROR "gaierror: Temporary failure in name resolution"
|
||||
http GET (outer middleware span) duration=11.7ms status=ok
|
||||
|
||||
Diagnosis: the FAILING span has ERROR status and a DB-connection-specific
|
||||
exception message, and total request duration stayed ~11ms -- this is a fast,
|
||||
explicit dependency failure, NOT a slow handler (a slow handler would show a
|
||||
long-duration span with NO error status, e.g. an expensive query actually
|
||||
completing after several seconds). The combination of (a) 500 + ERROR span
|
||||
status + (b) short duration is how this scenario is distinguished: a
|
||||
"slow handler" incident would instead show long duration with status=ok.
|
||||
Reference in New Issue
Block a user