|
| 1 | +# Meet@Mensa Grafana Dashboards Documentation |
| 2 | + |
| 3 | +This directory contains Grafana dashboards for monitoring the Meet@Mensa microservices application. Each dashboard is designed to provide specific insights into different aspects of the system. |
| 4 | + |
| 5 | +**Business Request**: Any HTTP/API request that directly relates to core business functionality (e.g., creating match requests, user registration, GenAI interactions) - distinct from technical requests like health checks. |
| 6 | + |
| 7 | +## Dashboard Overview |
| 8 | + |
| 9 | +### 1. **Meet@Mensa Overview** (`meetatmensa-overview.json`) |
| 10 | +**Purpose**: High-level system overview for executive and operational monitoring |
| 11 | + |
| 12 | +**Key Metrics Monitored**: |
| 13 | +- **Request Rate (req/sec)**: Total requests per second across all services |
| 14 | + - *Why monitor*: Indicates system load and user activity |
| 15 | + - *Alert threshold*: >80 req/sec (red), >100 req/sec (yellow) |
| 16 | +- **Active Requests**: Number of concurrent requests being processed |
| 17 | + - *Why monitor*: System load and capacity utilization |
| 18 | + - *Alert threshold*: >100 active requests (warning) |
| 19 | +- **Memory Usage**: Memory consumption across services |
| 20 | + - *Why monitor*: Resource utilization and potential memory leaks |
| 21 | + - *Alert threshold*: >80% (warning), >90% (critical) |
| 22 | +- **Active Threads**: Number of active threads per service |
| 23 | + - *Why monitor*: Thread pool utilization and performance |
| 24 | + |
| 25 | +**Alerts Configured**: |
| 26 | +- `ServiceDown`: Triggers when any service is down for >1 minute |
| 27 | +- `HighErrorRate`: Triggers when error rate >5% for 5 minutes |
| 28 | +- `CriticalErrorRate`: Triggers when error rate >10% for 3 minutes |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +### 2. **Meet@Mensa Application** (`meetatmensa-application.json`) |
| 33 | +**Purpose**: Business-focused metrics and application performance |
| 34 | + |
| 35 | +**Key Metrics Monitored**: |
| 36 | +- **Business Request Rate**: Requests per second for business operations |
| 37 | + - *Why monitor*: Track user engagement and feature usage |
| 38 | +- **Active Business Requests**: Number of concurrent business operations |
| 39 | + - *Why monitor*: Business activity and system load |
| 40 | +- **Database Connections by Service**: Active database connections per service |
| 41 | + - *Why monitor*: Database connection pool utilization |
| 42 | +- **Database Idle Connections by Service**: Idle database connections per service |
| 43 | + - *Why monitor*: Connection pool efficiency and resource management |
| 44 | + |
| 45 | +**Alerts Configured**: |
| 46 | +- `LowRequestRate`: Triggers when request rate <0.1 req/sec for 10 minutes |
| 47 | +- `HighActiveRequests`: Triggers when active requests >100 for 5 minutes |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +### 3. **Meet@Mensa Microservices** (`meetatmensa-microservices.json`) |
| 52 | +**Purpose**: Detailed service-level monitoring and troubleshooting |
| 53 | + |
| 54 | +**Key Metrics Monitored**: |
| 55 | +- **Request Rate by Service**: Individual service request rates |
| 56 | + - *Why monitor*: Identify bottlenecks and service-specific issues |
| 57 | +- **JVM Memory Usage (%)**: Java Virtual Machine memory utilization per service |
| 58 | + - *Why monitor*: Memory leaks and resource management |
| 59 | +- **Active Threads**: Number of active threads per service |
| 60 | + - *Why monitor*: Thread pool utilization and performance |
| 61 | +- **Database Active Connections**: Active database connections per service |
| 62 | + - *Why monitor*: Database performance and connection management |
| 63 | + |
| 64 | +**Alerts Configured**: |
| 65 | +- `HighMemoryUsage`: Triggers when memory usage >80% for 10 minutes |
| 66 | +- `CriticalMemoryUsage`: Triggers when memory usage >90% for 5 minutes |
| 67 | +- `DatabaseConnectionPoolExhausted`: Triggers when pool usage >80% for 5 minutes |
| 68 | +- `DatabaseConnectionPoolFull`: Triggers when pool usage >95% for 2 minutes |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +### 4. **Meet@Mensa Logs** (`meetatmensa-logs.json`) |
| 73 | +**Purpose**: Centralized log analysis and error tracking |
| 74 | + |
| 75 | +**Key Metrics Monitored**: |
| 76 | +- **Error and Warning Rate**: Log-based error and warning frequency |
| 77 | + - *Why monitor*: Proactive error detection and debugging |
| 78 | +- **Error and Warning Logs**: Detailed error and warning log entries |
| 79 | + - *Why monitor*: Identify problematic services and error patterns |
| 80 | +- **Info Logs**: Information-level log entries |
| 81 | + - *Why monitor*: General system activity and debugging |
| 82 | + |
| 83 | +**Data Source**: Loki (log aggregation) |
| 84 | +**Query Examples**: |
| 85 | +- `sum(rate({job="meetatmensa-app"} | json | level="ERROR" [5m])) by (container_name)` |
| 86 | +- `sum(rate({job="meetatmensa-app"} | json | level="WARN" [5m])) by (container_name)` |
| 87 | + |
| 88 | +--- |
| 89 | + |
| 90 | +### 5. **Meet@Mensa Custom Metrics** (`meetatmensa-custom-metrics.json`) |
| 91 | +**Purpose**: Business-specific metrics and KPIs |
| 92 | + |
| 93 | +**Key Metrics Monitored**: |
| 94 | +- **Total Users Created**: Cumulative user registrations |
| 95 | + - *Why monitor*: Business growth and user acquisition |
| 96 | + - *Metric name*: `users_total` |
| 97 | +- **Total Match Requests Created**: Cumulative match requests |
| 98 | + - *Why monitor*: Core business activity and user engagement |
| 99 | + - *Metric name*: `match_requests_total` |
| 100 | +- **Total GenAI Requests**: Cumulative AI-powered conversation starter requests |
| 101 | + - *Why monitor*: Feature adoption and AI service performance |
| 102 | + - *Metric name*: `genai_requests_total` |
| 103 | +- **Registration and Request Rates**: User registration and match request rates over time |
| 104 | + - *Why monitor*: Business activity trends and user engagement |
| 105 | +- **GenAI Request Rate**: AI service requests per time period |
| 106 | + - *Why monitor*: AI feature usage patterns and performance |
| 107 | + |
| 108 | +**Note**: These metrics require custom implementation in the application code. |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +### 6. **Sample Dashboard** (`sample-dashboard.json`) |
| 113 | +**Purpose**: Template and example dashboard for reference |
| 114 | + |
| 115 | +**Key Metrics Monitored**: |
| 116 | +- **New panel**: Example panel for testing and learning |
| 117 | + - *Why monitor*: Template for creating new dashboard panels |
| 118 | + |
| 119 | +**Usage**: |
| 120 | +- Reference for creating new dashboards |
| 121 | +- Testing dashboard configurations |
| 122 | +- Learning Grafana dashboard structure |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## Alert Strategy |
| 127 | + |
| 128 | +### Alert Severity Levels |
| 129 | + |
| 130 | +1. **Critical (Red)**: Immediate action required |
| 131 | + - Service down |
| 132 | + - High error rates (>10%) |
| 133 | + - Critical response times (>2s) |
| 134 | + - Memory usage >90% |
| 135 | + |
| 136 | +2. **Warning (Yellow)**: Attention needed |
| 137 | + - High error rates (>5%) |
| 138 | + - High response times (>1s) |
| 139 | + - Memory usage >80% |
| 140 | + - Database connection pool >80% |
| 141 | + |
| 142 | +3. **Info (Blue)**: Monitoring |
| 143 | + - Low request rates |
| 144 | + - High active requests |
| 145 | + |
| 146 | +### Alert Response Actions |
| 147 | + |
| 148 | +**Service Down**: |
| 149 | +1. Check container status: `docker ps` |
| 150 | +2. Check service logs: `docker logs <container>` |
| 151 | +3. Restart service if needed: `docker-compose restart <service>` |
| 152 | + |
| 153 | +**High Error Rate**: |
| 154 | +1. Check application logs in Grafana |
| 155 | +2. Review recent deployments |
| 156 | +3. Check database connectivity |
| 157 | +4. Scale service if needed |
| 158 | + |
| 159 | +**High Response Time**: |
| 160 | +1. Check CPU and memory usage |
| 161 | +2. Review database performance |
| 162 | +3. Check network connectivity |
| 163 | +4. Consider service scaling |
| 164 | + |
| 165 | +**Memory Issues**: |
| 166 | +1. Check for memory leaks |
| 167 | +2. Review garbage collection logs |
| 168 | +3. Increase memory limits if needed |
| 169 | +4. Restart service if critical |
| 170 | + |
| 171 | +--- |
| 172 | + |
| 173 | +## Data Sources |
| 174 | + |
| 175 | +### Prometheus |
| 176 | +- **Purpose**: Metrics collection and storage |
| 177 | +- **URL**: `http://prometheus:9090` |
| 178 | +- **Metrics**: System metrics, application metrics, custom business metrics |
| 179 | + |
| 180 | +### Loki |
| 181 | +- **Purpose**: Log aggregation and querying |
| 182 | +- **URL**: `http://loki:3100` |
| 183 | +- **Data**: Application logs, error logs, access logs |
| 184 | + |
| 185 | +--- |
| 186 | + |
| 187 | +## Dashboard Refresh and Updates |
| 188 | + |
| 189 | +### Automatic Refresh |
| 190 | +- Dashboards refresh every 30 seconds by default |
| 191 | +- Time range: Last 1 hour (configurable) |
| 192 | + |
| 193 | +### Manual Updates |
| 194 | +To apply dashboard changes: |
| 195 | +```bash |
| 196 | +# Restart Grafana container |
| 197 | +docker-compose -f deployment/docker/compose.yml restart grafana |
| 198 | + |
| 199 | +# Or restart the entire stack |
| 200 | +docker-compose -f deployment/docker/compose.yml down |
| 201 | +docker-compose -f deployment/docker/compose.yml up -d |
| 202 | +``` |
| 203 | + |
| 204 | +### Dashboard Provisioning |
| 205 | +Dashboards are automatically provisioned from JSON files in this directory. Changes to JSON files require a Grafana restart to take effect. |
| 206 | + |
| 207 | +--- |
| 208 | + |
| 209 | +## Troubleshooting |
| 210 | + |
| 211 | +### No Data in Dashboards |
| 212 | +1. **Check Prometheus targets**: Visit `http://localhost:9090/targets` |
| 213 | +2. **Verify service endpoints**: Check `/actuator/prometheus` endpoints |
| 214 | +3. **Check time range**: Ensure dashboard time range includes data |
| 215 | +4. **Verify metric names**: Use Prometheus UI to search for metrics |
| 216 | + |
| 217 | +### Missing Custom Metrics |
| 218 | +1. **Check application code**: Ensure metrics are properly implemented |
| 219 | +2. **Verify metric names**: Match exact names in dashboard queries |
| 220 | +3. **Check Prometheus configuration**: Ensure services are scraped |
| 221 | +4. **Restart services**: Reload metrics after code changes |
| 222 | + |
| 223 | +### Log Issues |
| 224 | +1. **Check Promtail configuration**: Verify log collection setup |
| 225 | +2. **Check Loki connectivity**: Ensure Loki is running and accessible |
| 226 | +3. **Verify log format**: Ensure logs are in expected JSON format |
| 227 | +4. **Check container logs**: Verify logs are being generated |
| 228 | + |
| 229 | +--- |
| 230 | + |
| 231 | +## Best Practices |
| 232 | + |
| 233 | +1. **Monitor Key Business Metrics**: Focus on metrics that impact user experience |
| 234 | +2. **Set Appropriate Thresholds**: Base thresholds on historical data and SLAs |
| 235 | +3. **Use Meaningful Alert Messages**: Include actionable information in alerts |
| 236 | +4. **Regular Dashboard Reviews**: Update dashboards based on changing needs |
| 237 | +5. **Document Changes**: Update this README when adding new metrics or alerts |
| 238 | + |
| 239 | +--- |
| 240 | + |
| 241 | +## Contact |
| 242 | + |
| 243 | +For questions about monitoring setup or dashboard configuration, refer to the team documentation or contact the DevOps team. |
0 commit comments