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
+70
View File
@@ -0,0 +1,70 @@
# OTel Collector contrib 0.164.0 (design change otel-telemetry, решения 1, 3,
# 14): получатель, обработчик и экспортёр, не хранилище. Три pipeline — каждый
# до своего хранилища: метрики — scrape Prometheus с экспортёра prometheus,
# логи — Loki (родной OTLP), трассы — Tempo. Расширений нет (pprof, zpages,
# health_check образа не берутся). Порты наружу не публикуются: OTLP
# слушает сеть приложения, :8888 и :8889 забирает Prometheus в сети
# telemetry.
receivers:
otlp:
protocols:
# только OTLP/HTTP: SDK приложения отправляет protobuf по HTTP
http:
endpoint: 0.0.0.0:4318
processors:
# предел памяти Collector: при 200 МиБ отказ приёма (SDK получает ошибку и
# теряет пакет), всплеск — 40 МиБ; GOMEMLIMIT контейнера — 160 МиБ
memory_limiter:
check_interval: 1s
limit_mib: 200
spike_limit_mib: 40
# пакеты до хранилищ: не больше 1024 элементов или раз в секунду
batch:
send_batch_size: 1024
timeout: 1s
exporters:
# метрики приложения для scrape Prometheus (honor_labels): job =
# service.name, instance = service.instance.id, остальной ресурс —
# target_info; ряды остановленной реплики уходят через 5 мин
prometheus:
endpoint: 0.0.0.0:8889
translation_strategy: UnderscoreEscapingWithSuffixes
metric_expiration: 5m
resource_to_telemetry_conversion:
enabled: false
# sending_queue и retry_on_failure — по умолчанию: явные пределы и учёт
# потерь — change 3 (уровень 4)
otlp_http/loki:
endpoint: http://loki:3100/otlp
otlp_http/tempo:
endpoint: http://tempo:4318
service:
telemetry:
logs:
level: info
encoding: json
# собственные метрики Collector — для Prometheus (жив ли конвейер)
metrics:
level: normal
readers:
- pull:
exporter:
prometheus:
host: 0.0.0.0
port: 8888
pipelines:
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [prometheus]
logs:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlp_http/loki]
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlp_http/tempo]