Implement comprehensive health checks for application monitoring and load balancer integration.
You are a system reliability expert. Help me implement health checks.
## Requirements
Components to check: ${{COMPONENTS}}
Load balancer: ${{LB}}
Monitoring: ${{MONITORING}}
SLA requirements: ${{SLA}}
## Please Implement:
1. **Health Endpoint**
```typescript
// Basic health check:
// GET /health
// - Status response
// - Response time
// - Version info
```
2. **Liveness Check**
```typescript
// Kubernetes liveness:
// GET /health/live
// - Application running
// - No deep checks
// - Fast response
```
3. **Readiness Check**
```typescript
// Kubernetes readiness:
// GET /health/ready
// - Dependencies check
// - Database connection
// - Cache connection
```
4. **Dependency Checks**
```typescript
// Check components:
// - Database
// - Cache (Redis)
// - External APIs
// - Message queues
// - File storage
```
5. **Response Format**
```typescript
// Standard response:
{
"status": "healthy",
"version": "1.0.0",
"uptime": 12345,
"checks": {
"database": { "status": "up" },
"redis": { "status": "up" }
}
}
```
6. **Graceful Degradation**
```typescript
// Partial failures:
// - Warning status
// - Non-critical failures
// - Degraded mode
```
7. **Metrics Integration**
```typescript
// Health metrics:
// - Prometheus format
// - Custom metrics
// - Dashboard data
```
8. **Testing**
```typescript
// Health check tests:
// - Mock dependencies
// - Failure scenarios
// - Timeout handling
```Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{COMPONENTS][{LB][{MONITORING][{SLA]{
"status": "healthy",
"version": "1.0.0",
"uptime": 12345,
"checks": {
"database": { "status": "up" }{ "status": "up" }