pub struct HealthCheckRegistry { /* private fields */ }Expand description
Registry and concurrent runner for product-provided health checks.
The registry owns scope selection, timeout handling, panic-to-report
conversion, concurrent execution, registration-order output, and aggregate
status calculation. Product code owns the actual probe logic and should
return a HealthComponentReport with product-specific diagnostics.
Implementations§
Source§impl HealthCheckRegistry
impl HealthCheckRegistry
Sourcepub fn configured<F>(configure: F) -> Selfwhere
F: FnOnce(&mut Self),
pub fn configured<F>(configure: F) -> Selfwhere
F: FnOnce(&mut Self),
Creates a registry and applies one registration function.
This is the lightweight path for product code that only needs to run
health probes. Use RuntimeComponentRegistry
only when the caller also needs component metadata or shutdown phases.
Sourcepub fn configure<F>(&mut self, configure: F) -> &mut Selfwhere
F: FnOnce(&mut Self),
pub fn configure<F>(&mut self, configure: F) -> &mut Selfwhere
F: FnOnce(&mut Self),
Applies one registration function and returns the registry.
The shape intentionally mirrors Actix Web’s configure pattern, so
subsystem modules can expose small registration functions without owning
the root registry.
Sourcepub fn register_with_options<F, Fut>(
&mut self,
name: &'static str,
options: HealthCheckOptions,
check: F,
) -> &mut Self
pub fn register_with_options<F, Fut>( &mut self, name: &'static str, options: HealthCheckOptions, check: F, ) -> &mut Self
Registers a health check with full options.
name is also used for timeout and panic reports. The check future
should return a component report with the same stable name.
Sourcepub fn register_required<F, Fut>(
&mut self,
name: &'static str,
timeout: Option<Duration>,
check: F,
) -> &mut Self
pub fn register_required<F, Fut>( &mut self, name: &'static str, timeout: Option<Duration>, check: F, ) -> &mut Self
Registers a required health check.
Sourcepub fn register_optional<F, Fut>(
&mut self,
name: &'static str,
timeout: Option<Duration>,
check: F,
) -> &mut Self
pub fn register_optional<F, Fut>( &mut self, name: &'static str, timeout: Option<Duration>, check: F, ) -> &mut Self
Registers an optional health check.
Sourcepub async fn run(&self) -> SystemHealthReport
pub async fn run(&self) -> SystemHealthReport
Runs registered checks concurrently and returns an aggregate report.
Component reports are returned in registration order even though checks run concurrently.
Sourcepub async fn run_scope(&self, scope: HealthCheckScope) -> SystemHealthReport
pub async fn run_scope(&self, scope: HealthCheckScope) -> SystemHealthReport
Runs only checks registered for scope.
Sourcepub fn descriptors(&self) -> Vec<HealthCheckDescriptor>
pub fn descriptors(&self) -> Vec<HealthCheckDescriptor>
Returns registered check descriptors in registration order.
Sourcepub fn descriptors_for_scope(
&self,
scope: HealthCheckScope,
) -> Vec<HealthCheckDescriptor>
pub fn descriptors_for_scope( &self, scope: HealthCheckScope, ) -> Vec<HealthCheckDescriptor>
Returns registered descriptors that belong to scope.