Добавлены метрики Prometheus и дашборды Grafana (этап 2.5)

Все три Go-сервиса (ingest, device-control, rule-engine) отдают
/metrics в формате Prometheus: счётчики MQTT/RabbitMQ/ClickHouse
операций, гистограммы длительности батч-флашей и диспатча правил,
переходы устройств online/offline. Добавлены сервисы prometheus и
grafana в docker-compose с провижининг конфигом (datasource +
два готовых дашборда: "Ingest & Telemetry" и "Automation & Devices").
This commit is contained in:
2026-08-11 21:58:59 +05:00
parent 3ade5c2512
commit 81040eec62
31 changed files with 712 additions and 53 deletions
+36
View File
@@ -8,6 +8,8 @@ volumes:
redis-data:
rabbitmq-data:
mosquitto-data:
prometheus-data:
grafana-data:
services:
mosquitto:
@@ -92,6 +94,8 @@ services:
ingest-service:
build: ./services/ingest-service
ports:
- "${INGEST_METRICS_PORT}:9101"
environment:
MQTT_HOST: mosquitto
MQTT_PORT: 1883
@@ -104,6 +108,7 @@ services:
RABBITMQ_PORT: 5672
RABBITMQ_USER: ${RABBITMQ_USER}
RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD}
INGEST_METRICS_PORT: 9101
depends_on:
mosquitto:
condition: service_started
@@ -152,6 +157,8 @@ services:
build:
context: .
dockerfile: services/rule-engine-service/Dockerfile
ports:
- "${RULE_ENGINE_METRICS_PORT}:9102"
environment:
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
@@ -165,6 +172,7 @@ services:
RABBITMQ_USER: ${RABBITMQ_USER}
RABBITMQ_PASSWORD: ${RABBITMQ_PASSWORD}
RULE_ENGINE_CACHE_REFRESH_INTERVAL: ${RULE_ENGINE_CACHE_REFRESH_INTERVAL}
RULE_ENGINE_METRICS_PORT: 9102
depends_on:
postgres:
condition: service_healthy
@@ -222,5 +230,33 @@ services:
- home-automation
restart: unless-stopped
prometheus:
image: prom/prometheus:v3.1.0
ports:
- "${PROMETHEUS_PORT}:9090"
volumes:
- ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
networks:
- home-automation
restart: unless-stopped
grafana:
image: grafana/grafana:11.4.0
ports:
- "${GRAFANA_PORT}:3000"
environment:
GF_SECURITY_ADMIN_USER: ${GRAFANA_ADMIN_USER}
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD}
GF_USERS_ALLOW_SIGN_UP: "false"
volumes:
- grafana-data:/var/lib/grafana
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
depends_on:
- prometheus
networks:
- home-automation
restart: unless-stopped
# Remaining app services (health-check-service, esp32-emulator) are added
# here as they get implemented — see services/*/README.md for the plan.