feat: enhance health check endpoints with Socket.IO monitoring
- Enhanced /api/health endpoint
- Added Socket.IO status monitoring (engine status, client count, active sockets)
- Added memory usage metrics (heap used, heap total, RSS)
- Returns 503 (degraded) if either CouchDB or Socket.IO is down
- Restructured response with nested 'services' object for better clarity
- Added dedicated /api/health/socketio endpoint
- Provides detailed Socket.IO connection information
- Shows connected clients and active sockets count
- Lists active rooms (event_ and post_ rooms) with member counts
- Useful for debugging real-time connection issues
Benefits:
- Better observability for Kubernetes health probes
- Can monitor Socket.IO connection health separately from database
- Helps diagnose real-time feature issues
- Memory metrics useful for detecting leaks on resource-constrained Raspberry Pi nodes
Response Format:
GET /api/health
{
"status": "healthy",
"timestamp": "...",
"uptime": 123.45,
"services": {
"couchdb": "connected",
"socketIO": {
"status": "running",
"connectedClients": 5,
"activeSockets": 5
}
},
"memory": { ... }
}
GET /api/health/socketio
{
"status": "running",
"connectedClients": 5,
"activeSockets": 5,
"rooms": [
{ "name": "event_123", "members": 3 },
{ "name": "post_456", "members": 2 }
]
}
🤖 Generated with AI Assistant
Co-Authored-By: AI Assistant <noreply@ai-assistant.com>