mirror of
https://github.com/lintsinghua/DeepAudit.git
synced 2026-11-22 05:07:12 +08:00
3.3 KiB
3.3 KiB
Monitoring Stack
This directory contains configuration files for the XCodeReviewer monitoring and observability stack.
Quick Start
# Start monitoring services
docker-compose -f docker-compose.monitoring.yml up -d
# View logs
docker-compose -f docker-compose.monitoring.yml logs -f
# Stop services
docker-compose -f docker-compose.monitoring.yml down
Services
Prometheus (Port 9090)
- Metrics collection and storage
- Access: http://localhost:9090
- Config:
prometheus.yml - Rules:
prometheus_rules.yml
Grafana (Port 3001)
- Metrics visualization
- Access: http://localhost:3001
- Default credentials: admin/admin
- Datasources:
grafana/datasources/ - Dashboards:
grafana/dashboards/
Alertmanager (Port 9093)
- Alert routing and management
- Access: http://localhost:9093
- Config:
alertmanager.yml
Jaeger (Port 16686)
- Distributed tracing
- Access: http://localhost:16686
- OTLP endpoint: localhost:4317
Configuration Files
monitoring/
├── prometheus.yml # Prometheus configuration
├── prometheus_rules.yml # Alert rules
├── alertmanager.yml # Alert routing configuration
└── grafana/
├── datasources/ # Grafana datasource configs
│ └── prometheus.yml
└── dashboards/ # Grafana dashboard configs
└── dashboard.yml
Metrics Endpoint
The backend exposes metrics at:
http://localhost:8000/metrics
Alert Configuration
Edit alertmanager.yml to configure notification channels:
Slack
slack_configs:
- api_url: 'YOUR_WEBHOOK_URL'
channel: '#alerts'
email_configs:
- to: 'team@example.com'
from: 'alerts@example.com'
smarthost: 'smtp.gmail.com:587'
PagerDuty
pagerduty_configs:
- service_key: 'YOUR_SERVICE_KEY'
Custom Dashboards
- Open Grafana at http://localhost:3001
- Login with admin/admin
- Create new dashboard
- Add panels with Prometheus queries
- Save dashboard
Example queries:
# Request rate
rate(http_requests_total[5m])
# Error rate
sum(rate(http_requests_total{status_code=~"5.."}[5m])) / sum(rate(http_requests_total[5m]))
# Response time (95th percentile)
histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m]))
Troubleshooting
Prometheus not scraping metrics
- Check backend is running:
curl http://localhost:8000/metrics - Check Prometheus targets: http://localhost:9090/targets
- Verify network connectivity between containers
Alerts not firing
- Check alert rules: http://localhost:9090/alerts
- Verify Alertmanager config: http://localhost:9093
- Check Alertmanager logs:
docker logs xcodereview-alertmanager
Jaeger not receiving traces
- Verify OTLP endpoint is accessible
- Check backend environment:
TRACING_ENABLED=true - Check Jaeger logs:
docker logs xcodereview-jaeger
Documentation
For detailed documentation, see:
Production Considerations
- Configure persistent storage for Prometheus data
- Set up remote storage for long-term metrics
- Configure authentication for Grafana
- Set up SSL/TLS for all services
- Configure backup strategy
- Set up log rotation
- Configure resource limits
- Set up high availability (if needed)