Health Checks
Built-in Endpoints
Section titled “Built-in Endpoints”Every JustAPI application exposes three health endpoints by default:
| Endpoint | Type | Returns | Use |
|---|---|---|---|
GET /health |
Liveness | 200 {"status":"ok"} |
Process alive check |
GET /live |
Liveness | 200 {"status":"ok"} |
Lightweight alias |
GET /ready |
Readiness | 200 or 503 |
Dependency health |
Readiness Probe
Section titled “Readiness Probe”/ready returns 503 if any registered health check fails:
curl http://localhost:8000/ready# When healthy: {"status":"ok","checks":{"postgres":"healthy"}}# When unhealthy: {"status":"unavailable","checks":{"postgres":"unhealthy"}}Custom Health Checks
Section titled “Custom Health Checks”app.register_health_check("postgres", lambda: check_db_connection())app.register_health_check("redis", lambda: check_redis_connection())app.register_health_check("external_api", lambda: ping_external_api())Each check function should return True (healthy) or raise an exception.
Kubernetes Probe Configuration
Section titled “Kubernetes Probe Configuration”livenessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 5 periodSeconds: 15
readinessProbe: httpGet: path: /ready port: 8080 initialDelaySeconds: 10 periodSeconds: 10 failureThreshold: 3See Also
Section titled “See Also”- Metrics & Monitoring — Prometheus metrics
- OpenTelemetry — Distributed tracing
- Production Checklist — Production setup