Skip to main content

HealthCheckRegistry

Struct HealthCheckRegistry 

Source
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

Source

pub fn new() -> Self

Creates an empty health check registry.

Source

pub fn configured<F>(configure: F) -> Self
where 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.

Source

pub fn configure<F>(&mut self, configure: F) -> &mut Self
where 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.

Source

pub fn register_with_options<F, Fut>( &mut self, name: &'static str, options: HealthCheckOptions, check: F, ) -> &mut Self
where F: Fn() -> Fut + Send + Sync + 'static, Fut: Future<Output = HealthComponentReport> + Send + 'static,

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.

Source

pub fn register_required<F, Fut>( &mut self, name: &'static str, timeout: Option<Duration>, check: F, ) -> &mut Self
where F: Fn() -> Fut + Send + Sync + 'static, Fut: Future<Output = HealthComponentReport> + Send + 'static,

Registers a required health check.

Source

pub fn register_optional<F, Fut>( &mut self, name: &'static str, timeout: Option<Duration>, check: F, ) -> &mut Self
where F: Fn() -> Fut + Send + Sync + 'static, Fut: Future<Output = HealthComponentReport> + Send + 'static,

Registers an optional health check.

Source

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.

Source

pub async fn run_scope(&self, scope: HealthCheckScope) -> SystemHealthReport

Runs only checks registered for scope.

Source

pub fn len(&self) -> usize

Returns how many health checks are registered.

Source

pub fn is_empty(&self) -> bool

Returns whether no health checks are registered.

Source

pub fn descriptors(&self) -> Vec<HealthCheckDescriptor>

Returns registered check descriptors in registration order.

Source

pub fn descriptors_for_scope( &self, scope: HealthCheckScope, ) -> Vec<HealthCheckDescriptor>

Returns registered descriptors that belong to scope.

Trait Implementations§

Source§

impl Default for HealthCheckRegistry

Source§

fn default() -> HealthCheckRegistry

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more