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:
@@ -78,6 +78,47 @@ services:
|
||||
- source: haproxy_cfg
|
||||
target: /usr/local/etc/haproxy/haproxy.cfg
|
||||
|
||||
# наблюдаемость (design change otel-telemetry, решение 20): те же сервисы,
|
||||
# конфиги — configs; у хранилищ остаётся только именованный volume, у
|
||||
# Grafana — tmpfs (не volumes) и ни одного порта на хосте
|
||||
otel-collector:
|
||||
volumes: !reset []
|
||||
configs:
|
||||
- source: otel_collector
|
||||
target: /etc/otelcol-contrib/config.yaml
|
||||
|
||||
prometheus:
|
||||
volumes: !override
|
||||
- prometheus_data:/prometheus
|
||||
configs:
|
||||
- source: prometheus_yml
|
||||
target: /etc/prometheus/prometheus.yml
|
||||
|
||||
loki:
|
||||
volumes: !override
|
||||
- loki_data:/loki
|
||||
configs:
|
||||
- source: loki_yaml
|
||||
target: /etc/loki/loki.yaml
|
||||
|
||||
tempo:
|
||||
volumes: !override
|
||||
- tempo_data:/var/tempo
|
||||
configs:
|
||||
- source: tempo_yaml
|
||||
target: /etc/tempo/tempo.yaml
|
||||
|
||||
grafana:
|
||||
ports: !reset []
|
||||
volumes: !reset []
|
||||
configs:
|
||||
- source: grafana_datasources
|
||||
target: /etc/grafana/provisioning/datasources/datasources.yaml
|
||||
- source: grafana_dashboards
|
||||
target: /etc/grafana/provisioning/dashboards/dashboards.yaml
|
||||
- source: grafana_dashboard_overview
|
||||
target: /etc/grafana/dashboards/messenger-overview.json
|
||||
|
||||
# файлы по умолчанию 0444 и root: непривилегированные пользователи
|
||||
# контейнеров читают, но не меняют — как read_only у bind mount
|
||||
configs:
|
||||
@@ -91,3 +132,17 @@ configs:
|
||||
environment: CI_RABBITMQ_CONF
|
||||
haproxy_cfg:
|
||||
environment: CI_HAPROXY_CFG
|
||||
otel_collector:
|
||||
environment: CI_OTEL_COLLECTOR
|
||||
prometheus_yml:
|
||||
environment: CI_PROMETHEUS_YML
|
||||
loki_yaml:
|
||||
environment: CI_LOKI_YAML
|
||||
tempo_yaml:
|
||||
environment: CI_TEMPO_YAML
|
||||
grafana_datasources:
|
||||
environment: CI_GRAFANA_DATASOURCES
|
||||
grafana_dashboards:
|
||||
environment: CI_GRAFANA_DASHBOARDS
|
||||
grafana_dashboard_overview:
|
||||
environment: CI_GRAFANA_DASHBOARD_OVERVIEW
|
||||
|
||||
@@ -12,6 +12,16 @@ CI_S3_BOOTSTRAP="$(cat infra/s3/bootstrap.sh)$nl"
|
||||
CI_HAPROXY_CFG="$(cat infra/haproxy/haproxy.cfg)$nl"
|
||||
CI_RABBITMQ_CONF="$(cat infra/rabbitmq/rabbitmq.conf)$nl"
|
||||
export CI_CONFIG_TOML CI_VALKEY_CONF CI_S3_BOOTSTRAP CI_HAPROXY_CFG CI_RABBITMQ_CONF
|
||||
# наблюдаемость (design change otel-telemetry, решение 20)
|
||||
CI_OTEL_COLLECTOR="$(cat infra/otel/collector.yaml)$nl"
|
||||
CI_PROMETHEUS_YML="$(cat infra/otel/prometheus/prometheus.yml)$nl"
|
||||
CI_LOKI_YAML="$(cat infra/otel/loki/loki.yaml)$nl"
|
||||
CI_TEMPO_YAML="$(cat infra/otel/tempo/tempo.yaml)$nl"
|
||||
CI_GRAFANA_DATASOURCES="$(cat infra/otel/grafana/datasources.yaml)$nl"
|
||||
CI_GRAFANA_DASHBOARDS="$(cat infra/otel/grafana/dashboards.yaml)$nl"
|
||||
CI_GRAFANA_DASHBOARD_OVERVIEW="$(cat infra/otel/grafana/dashboards/messenger-overview.json)$nl"
|
||||
export CI_OTEL_COLLECTOR CI_PROMETHEUS_YML CI_LOKI_YAML CI_TEMPO_YAML \
|
||||
CI_GRAFANA_DATASOURCES CI_GRAFANA_DASHBOARDS CI_GRAFANA_DASHBOARD_OVERVIEW
|
||||
|
||||
# готовность стенда через LB: /health/ready отвечает 200 от API_REPLICAS
|
||||
# (из .env, по умолчанию 2) разных реплик — X-Instance-Id. Срок 60 с:
|
||||
|
||||
Reference in New Issue
Block a user