Detailed Health Check with Component Checks
Design a comprehensive health check response including per-component status, response times, and diagnostic messages for databases, caches, and external services.
Detailed Format
Detailed Explanation
Detailed Health Check with Components
A detailed health check response includes the overall status plus individual checks for each dependency your service relies on.
Response Format
{
"status": "UP",
"timestamp": "2024-01-15T10:30:00.000Z",
"uptime": "72h 14m 33s",
"version": "1.0.0",
"httpStatusCode": 200,
"checks": {
"database": {
"status": "UP",
"duration": "12ms",
"message": "PostgreSQL connection pool active"
},
"redis": {
"status": "UP",
"duration": "3ms",
"message": "Redis connection established"
},
"external-api": {
"status": "UP",
"duration": "145ms",
"message": "Payment gateway responding"
}
}
}
Key Fields
| Field | Purpose |
|---|---|
status |
Overall health: UP, DOWN, or DEGRADED |
timestamp |
When the check was performed |
uptime |
How long the service has been running |
version |
Application version for debugging |
checks |
Per-component health details |
duration |
Response time for each check |
Status Derivation
The overall status is derived from component checks:
- UP: All components healthy
- DEGRADED: Some components unhealthy but service partially functional
- DOWN: Critical components failed, service cannot operate
Monitoring Integration
Detailed responses enable monitoring dashboards to show per-component health, set up alerts on specific dependencies, and track response time trends. Tools like Grafana, Datadog, and Prometheus can parse these structured responses.
Use Case
Internal monitoring dashboards and observability platforms (Grafana, Datadog, New Relic) that need per-component health visibility for microservice architectures.