feat: add OpenTelemetry SDK, collector and telemetry stores

Collector (contrib), Prometheus, Loki, Tempo and Grafana with provisioning
from git; SDK in API and worker with level 3 metrics, traces and logs
carrying trace_id/span_id; telemetry off by default outside the stand;
broker healthcheck runs as the broker user so a fresh stand starts once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 10:19:50 +03:00
co-authored by Claude Opus 5.5
parent 9b35c256b7
commit a4497e3f32
62 changed files with 6175 additions and 214 deletions
+11
View File
@@ -97,6 +97,17 @@ access_log=False)`. Импорты в `src/__main__.py` — внутри `if __n
`REPORT.md` (design change `upload-memory`, решение 6). Проверки лабы 3 (≥2 реплики, failover,
гонка через разные реплики) — только на стенде compose через LB.
## Телеметрия (с лабы 6)
Design change `otel-telemetry`, решения 8, 13, 20. Консоль (`make run_dev`, `make
run_worker`) — без телеметрии: «Started API» говорит `telemetry_enabled: false`, к
`127.0.0.1:4318` обращений нет. На стенде compose её включает окружение `api` и `worker`.
Остановка: API закрывает SDK после «Stopped API» и ждёт не дольше
`TELEMETRY_SHUTDOWN_TIMEOUT_SECONDS` (1 с; 8 с дренажа + 1 с < 10 с), worker — в окне `gather`
закрытия клиентов (0,5 с; худший случай прежний, 9,5 с); `shutdown()` провайдеров — в
daemon-потоках, процесс их не ждёт. Без Collector и при замороженном Collector сроки прежние
(`driver.py telemetry-outage`).
## Уборщик (с лабы 4)
`python -m src.cleaner [--once]` → `src/cleaner/__main__.py` →