Monitoring¶
This guide shows how to set up Prometheus and Grafana monitoring for EUDIPLO in both local development and Docker container scenarios.
Quick Start¶
The monitoring stack includes:
- Prometheus on http://localhost:9090 - Metrics collection
- Grafana on http://localhost:3001 - Dashboards and visualization
Start Monitoring Stack¶
Local Development Setup¶
When running EUDIPLO locally (outside Docker) and monitoring with Docker:
1. Start EUDIPLO Locally¶
EUDIPLO will be available at http://localhost:3000 with metrics at http://localhost:3000/metrics
2. Configure Prometheus for Local EUDIPLO¶
Update monitor/prometheus/prometheus.yml
:
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'eudiplo-local'
static_configs:
- targets: ['host.docker.internal:3000'] # For local EUDIPLO
metrics_path: '/metrics'
scrape_interval: 30s
3. Start Monitoring¶
Docker Container Setup¶
When running EUDIPLO as a Docker container:
1. Update Prometheus Configuration¶
Edit monitor/prometheus/prometheus.yml
:
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'eudiplo-docker'
static_configs:
- targets: ['eudiplo:3000'] # For Docker container
metrics_path: '/metrics'
scrape_interval: 30s
2. Add EUDIPLO to Docker Compose¶
Add to monitor/docker-compose.yml
:
services:
eudiplo:
image: eudiplo/eudiplo:latest
ports:
- '3000:3000'
environment:
- NODE_ENV=development
- PUBLIC_URL=http://localhost:3000
networks:
- monitoring
prometheus:
# ... existing config
networks:
monitoring:
driver: bridge
3. Start Full Stack¶
Key Metrics¶
EUDIPLO exposes these important metrics:
Business Metrics¶
sessions
- Active, completed, and failed sessions
More values will be added as the project evolves.
Access Dashboards¶
-
Prometheus: http://localhost:9090
- View metrics and run queries
- Check targets status at
/targets
-
Grafana: http://localhost:3001
- Username:
admin
- Password:
admin
- Import or create dashboards
- Username:
Configuration Files¶
Prometheus (prometheus/prometheus.yml
)¶
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'eudiplo'
static_configs:
- targets: ['host.docker.internal:3000'] # Local
# - targets: ['eudiplo:3000'] # Docker
scrape_interval: 30s
Grafana Data Source¶
Grafana is pre-configured with Prometheus as data source at
http://prometheus:9090
.
Troubleshooting¶
Common Issues¶
Prometheus can't reach EUDIPLO:
# Check if metrics endpoint is accessible
curl http://localhost:3000/metrics
# For local development, verify host.docker.internal works
docker run --rm appropriate/curl curl -I http://host.docker.internal:3000/metrics
No data in Grafana:
- Check Prometheus targets: http://localhost:9090/targets
- Verify time range in Grafana dashboards
- Ensure Prometheus data source is configured
Container issues:
# Check logs
docker-compose logs prometheus
docker-compose logs grafana
# Restart services
docker-compose restart
Production Considerations¶
For production deployments:
- Security: Change default Grafana password
- Retention: Configure appropriate data retention
- Backup: Set up regular backups of Grafana dashboards
- Alerting: Configure alertmanager for notifications
- Resources: Monitor resource usage and scale accordingly
Warning
The endpoint for /metrics
is not protected yet. So for now run the prometheus in the same network as the EUDIPLO instance. Authentication mechanisms will be added in the future.