Skip to main content

HealthCheck

Derive Macro HealthCheck 

Source
#[derive(HealthCheck)]
{
    // Attributes available to this derive:
    #[health]
}
Expand description

Derive a standalone health-check endpoint.

Generates a health_router() method returning an axum::Router with a single GET route (default /health) that responds with a fixed status string (default "ok"). The #[server] preset already mounts a /health route; use this derive to add one to a hand-rolled router.

§Attributes

  • #[health(path = "/healthz")] — override the route path (default /health)
  • #[health(status = "alive")] — override the response body (default "ok")

§Example

#[derive(HealthCheck)]
#[health(path = "/healthz", status = "alive")]
struct Probe;

let app = Probe.health_router();