1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! # modo::health
//!
//! Liveness and readiness probe endpoints for Kubernetes and container orchestration.
//!
//! Provides:
//! - [`router`] — returns a `Router<AppState>` with `GET /_live` and `GET /_ready` mounted.
//! - [`HealthCheck`] — trait for types that can verify their own readiness.
//! - [`HealthChecks`] — fluent builder that collects named checks and is placed
//! in the service [`Registry`](crate::service::Registry) for the readiness
//! handler to extract.
//!
//! [`crate::db::Database`] implements [`HealthCheck`] automatically, verifying
//! health by executing `SELECT 1` on the connection.
//!
//! # Endpoints
//!
//! - `GET /_live` — always returns `200 OK` (liveness probe).
//! - `GET /_ready` — runs registered checks concurrently, returns `200 OK`
//! if all pass or `503 Service Unavailable` if any fail; failures are
//! logged at `ERROR` level. When no checks are registered, responds `200`.
//!
//! # Example
//!
//! ```no_run
//! use modo::health::HealthChecks;
//! use modo::service::Registry;
//!
//! let checks = HealthChecks::new()
//! .check_fn("database", || async { Ok(()) })
//! .check_fn("redis", || async { Ok(()) });
//!
//! let mut registry = Registry::new();
//! registry.add(checks);
//!
//! let app: axum::Router = axum::Router::new()
//! .merge(modo::health::router())
//! .with_state(registry.into_state());
//! ```
pub use ;
pub use router;