sprout_monitoring
Comprehensive monitoring and logging solution using Prometheus, Grafana, Loki, and Alertmanager.
Overview
The sprout_monitoring repository provides:
- Prometheus for metrics collection
- Grafana for visualization and dashboards
- Loki for centralized logging
- Alertmanager for alerting
Technology Stack
- Prometheus: Metrics collection and storage
- Grafana: Visualization and dashboards
- Loki: Centralized logging
- Alertmanager: Alert routing and notification
- Pushgateway: Metrics from batch jobs
- Docker Compose: Service orchestration
Getting Started
Prerequisites
- Docker and Docker Compose
- Access to monitored services
Setup
-
Configure services: Edit
config/services.yamlwith your service URLs -
Generate Prometheus config:
./scripts/generate-prometheus-config.sh -
Start monitoring stack:
docker-compose up -d -
Access dashboards:
- Grafana: http://localhost:3000
- Prometheus: http://localhost:9090
- Loki: http://localhost:3100
Architecture
See Architecture Documentation for detailed architecture.
Monitored Services
HTTP Metrics Services
- sprout_backend (Port 3000) - NestJS API
- sprout_etl (Port 3001) - Fastify ETL service
Pushgateway Services
- sprout_backend Worker (Port 4001) - Background worker
- sprout_etl Worker (Port 4002) - ETL worker
Key Features
Metrics Collection
- HTTP scraping from
/metricsendpoints - Pushgateway for batch jobs and workers
- Custom service labeling
- Automatic service identification
Dashboards
- Sprout System Health - Overall system status
- ETL System Monitoring - ETL pipeline health
- Inventory Monitoring - Inventory metrics
- TickOps Quota Monitoring - API quota tracking
Alerting
- Service down alerts
- High error rate alerts
- Performance degradation alerts
- Worker health monitoring
Configuration
Service Configuration
Edit config/services.yaml:
services:
etl_fastify:
host: "host.docker.internal"
port: 3001
enabled: true
nestjs_monolith:
host: "host.docker.internal"
port: 3000
enabled: true
Prometheus Configuration
Generated from config/services.yaml:
./scripts/generate-prometheus-config.sh
Grafana Provisioning
- Datasources:
grafana/provisioning/datasources/ - Dashboards:
grafana/provisioning/dashboards/ - Alerting:
grafana/provisioning/alerting/
Deployment
Local Development
docker-compose up -d
Production
./scripts/deploy-monitoring-droplet.sh
Scripts
generate-prometheus-config.sh- Generate Prometheus configdeploy-monitoring-droplet.sh- Deploy to productionsetup-monitoring.sh- Setup monitoring stackrun-monitoring.sh- Run monitoring services
Documentation
- Architecture Documentation
- README.md - Full documentation
- DEPLOYMENT_GUIDE.md - Deployment guide
- QUICK_SETUP.md - Quick setup
- METRICS_SPECIFICATION.md - Metrics spec
Related Repositories
- sprout_backend - Monitored service
- sprout_etl - Monitored service