Skip to main content

HealthCheck

Trait HealthCheck 

Source
pub trait HealthCheck: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn health_check(&self) -> impl Future<Output = Result<(), StdError>> + Send;
}
Expand description

A named check reporting whether a part of the application is healthy.

Implementors are aggregated by the control server’s HealthRouter: a GET /health runs every registered check in registration order and fails on the first error, reporting that check’s name.

Register a check with AddHealthCheckExt::add_health_check (a concrete instance) or AddHealthCheckServiceExt::add_health_check_service (resolved from a Service).

Required Methods§

Source

fn name(&self) -> &str

Name reported when this check fails.

Source

fn health_check(&self) -> impl Future<Output = Result<(), StdError>> + Send

Performs the check, returning Err if the dependency is unhealthy.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§