pub struct AppHealthCheck { /* private fields */ }
Expand description
Application health check aggregating health from multiple components.
Implementations§
Source§impl AppHealthCheck
impl AppHealthCheck
pub fn new( slow_time_limit: Option<Duration>, hard_time_limit: Option<Duration>, ) -> Self
pub fn override_limits( &self, slow_time_limit: Option<Duration>, hard_time_limit: Option<Duration>, )
Sourcepub fn expose_metrics(&self)
pub fn expose_metrics(&self)
Sets the info metrics for the metrics time limits. This method should be called at most once when all the health checks are collected.
Sourcepub fn set_details(&self, details: impl Serialize)
pub fn set_details(&self, details: impl Serialize)
Sets app-level health details. They can include build info etc.
Sourcepub fn insert_component(
&self,
health_check: ReactiveHealthCheck,
) -> Result<(), AppHealthCheckError>
pub fn insert_component( &self, health_check: ReactiveHealthCheck, ) -> Result<(), AppHealthCheckError>
Inserts health check for a component.
§Errors
Returns an error if the component with the same name is already defined.
Sourcepub fn insert_custom_component(
&self,
health_check: Arc<dyn CheckHealth>,
) -> Result<(), AppHealthCheckError>
pub fn insert_custom_component( &self, health_check: Arc<dyn CheckHealth>, ) -> Result<(), AppHealthCheckError>
Inserts a custom health check for a component.
§Errors
Returns an error if the component with the same name is already defined.
Sourcepub async fn check_health(&self) -> AppHealth
pub async fn check_health(&self) -> AppHealth
Checks the overall application health. This will query all component checks concurrently.
Trait Implementations§
Source§impl Debug for AppHealthCheck
impl Debug for AppHealthCheck
Auto Trait Implementations§
impl !Freeze for AppHealthCheck
impl RefUnwindSafe for AppHealthCheck
impl Send for AppHealthCheck
impl Sync for AppHealthCheck
impl Unpin for AppHealthCheck
impl UnwindSafe for AppHealthCheck
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more