Health API¶
The Health API provides endpoints for monitoring system health, checking service readiness, and managing resilience patterns like circuit breakers and graceful degradation.
Overview¶
CalcBridge health monitoring supports:
- Liveness Probes: Simple process health for Kubernetes
- Readiness Probes: Dependency health (database, cache, broker)
- Deep Health Checks: Comprehensive multi-component status
- Circuit Breaker Management: Monitor and reset service circuit breakers
- Graceful Degradation: Feature flag and fallback management
- Maintenance Mode: Controlled service degradation
Basic Health Endpoints¶
Health Check¶
Basic health check returning system status.
Response¶
Readiness Check¶
Readiness check including dependency health.
Response¶
{
"status": "ready",
"version": "1.2.0",
"timestamp": "2026-01-25T10:30:00Z",
"checks": {
"database": {
"status": "ok",
"message": "Connection pool healthy"
},
"valkey": {
"status": "ok",
"message": "Connected"
}
}
}
When a dependency is unhealthy:
{
"status": "not_ready",
"version": "1.2.0",
"timestamp": "2026-01-25T10:30:00Z",
"checks": {
"database": {
"status": "error",
"message": "Connection timeout after 5s"
},
"valkey": {
"status": "ok",
"message": "Connected"
}
}
}
Liveness Check¶
Simple liveness check for Kubernetes probes.
Response¶
Detailed Health Check¶
Comprehensive health check with all component statuses.
Enhanced Health Endpoints¶
Deep Health Check¶
Comprehensive health check including all dependencies.
Resilience Status¶
Get status of circuit breakers and bulkheads.
Degradation Status¶
Get current graceful degradation status.
Full Degradation Status¶
Complete graceful degradation status with all fallback information.
Degradation History¶
Get recent degradation events.
Query Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 50 | Maximum events to return |
Circuit Breaker Management¶
Get Circuit Breaker Status¶
Get detailed circuit breaker metrics for a specific service.
Path Parameters¶
| Parameter | Type | Description |
|---|---|---|
service | string | Service name (e.g., database, valkey, celery) |
Reset Circuit Breaker¶
Reset a circuit breaker to closed state.
Admin Required
This endpoint requires admin privileges.
Reset All Circuit Breakers¶
Reset all circuit breakers to closed state.
Admin Required
This endpoint requires admin privileges.
Get All Service Health¶
Returns health status for all services with circuit breaker info.
Maintenance Mode¶
Toggle Maintenance Mode¶
Enter or exit maintenance mode.
Admin Required
This endpoint requires admin privileges.
Query Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
enable | boolean | - | Enable or disable maintenance mode |
message | string | "Scheduled maintenance in progress" | User-facing message |
Feature Flags¶
Get All Feature Flags¶
Get current status of all feature flags.
Update Feature Flags¶
Update feature flags.
Admin Required
This endpoint requires admin privileges.
Cache Management¶
Get Fallback Cache Status¶
Get in-memory fallback cache statistics.
Clear Fallback Cache¶
Clear all entries from the fallback cache.
Admin Required
This endpoint requires admin privileges.
Task Queue Monitoring¶
Get Sync Task Fallback Status¶
Get synchronous task fallback configuration and stats.
Get Celery Queue Depths¶
Get current depth of all Celery task queues.
Response¶
{
"queues": {
"default": 3,
"calculate": 0,
"parse": 1,
"priority": 0,
"export": 2
},
"total_pending": 6,
"timestamp": "2026-01-25T10:30:00Z"
}
Kubernetes Integration¶
Configure health probes in your deployment:
livenessProbe:
httpGet:
path: /health/live
port: 8000
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /health/ready
port: 8000
initialDelaySeconds: 5
periodSeconds: 10
startupProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 3
failureThreshold: 30
periodSeconds: 10
Related Documentation¶
- Metrics API - Prometheus metrics endpoint
- Dead Letter Queue API - Failed task management
- Architecture - System Design - Health check architecture