Expand description
Health check endpoint helpers for operations.
Provides standard health check patterns:
- Basic health: returns
{"status":"healthy"}onGET /health - Detailed health with named checks, critical flags, and per-check latency
- Kubernetes-style liveness (
/healthz) and readiness (/ready) probes
§Example
ⓘ
use fastapi_core::health::{HealthCheckRegistry, HealthStatus};
let mut registry = HealthCheckRegistry::new();
registry.add("database", true, || async {
// Check database connection
Ok(())
});
registry.add("cache", false, || async {
// Check cache connection (non-critical)
Ok(())
});
let result = futures_executor::block_on(registry.check_all());
assert_eq!(result.status, HealthStatus::Healthy);Structs§
- Health
Check Registry - Registry of health checks.
- Health
Check Result - Result of a single named health check.
- Health
Report - Aggregate result of all health checks.
Enums§
- Health
Status - Overall health status of the application.
Functions§
- basic_
health_ handler - Create a basic health check handler that returns
{"status":"healthy"}. - detailed_
health_ handler - Create a detailed health check handler from a registry.
- liveness_
handler - Create a Kubernetes liveness probe handler.
- readiness_
handler - Create a Kubernetes readiness probe handler from a registry.