pub struct HealthMonitor { /* private fields */ }Expand description
Health monitor for tracking subsystem health
Implementations§
Source§impl HealthMonitor
impl HealthMonitor
Sourcepub fn new(config: HealthMonitorConfig) -> Self
pub fn new(config: HealthMonitorConfig) -> Self
Create a new health monitor
Sourcepub fn with_default_config() -> Self
pub fn with_default_config() -> Self
Create with default configuration
Sourcepub fn register_subsystem(&self, name: String)
pub fn register_subsystem(&self, name: String)
Register a new subsystem for monitoring
Sourcepub fn unregister_subsystem(&self, name: &str) -> Result<(), HealthError>
pub fn unregister_subsystem(&self, name: &str) -> Result<(), HealthError>
Unregister a subsystem
Sourcepub fn update_health(
&self,
name: &str,
is_healthy: bool,
) -> Result<(), HealthError>
pub fn update_health( &self, name: &str, is_healthy: bool, ) -> Result<(), HealthError>
Update health status based on check result
Sourcepub fn set_health(
&self,
name: &str,
status: HealthStatus,
) -> Result<(), HealthError>
pub fn set_health( &self, name: &str, status: HealthStatus, ) -> Result<(), HealthError>
Manually set health status
Sourcepub fn check_health(&self, name: &str) -> Result<SubsystemHealth, HealthError>
pub fn check_health(&self, name: &str) -> Result<SubsystemHealth, HealthError>
Check health of a specific subsystem
Sourcepub fn overall_status(&self) -> HealthStatus
pub fn overall_status(&self) -> HealthStatus
Get overall system health status
Sourcepub fn all_subsystems(&self) -> HashMap<String, SubsystemHealth>
pub fn all_subsystems(&self) -> HashMap<String, SubsystemHealth>
Get all subsystem health statuses
Sourcepub fn status_counts(&self) -> HashMap<HealthStatus, usize>
pub fn status_counts(&self) -> HashMap<HealthStatus, usize>
Get count of subsystems by status
Sourcepub fn unhealthy_subsystems(&self) -> Vec<String>
pub fn unhealthy_subsystems(&self) -> Vec<String>
Get unhealthy subsystems
Sourcepub fn degraded_subsystems(&self) -> Vec<String>
pub fn degraded_subsystems(&self) -> Vec<String>
Get degraded subsystems
Sourcepub fn update_metadata(
&self,
name: &str,
key: String,
value: String,
) -> Result<(), HealthError>
pub fn update_metadata( &self, name: &str, key: String, value: String, ) -> Result<(), HealthError>
Update subsystem metadata
Sourcepub fn subsystem_count(&self) -> usize
pub fn subsystem_count(&self) -> usize
Get subsystem count
Auto Trait Implementations§
impl !Freeze for HealthMonitor
impl !RefUnwindSafe for HealthMonitor
impl Send for HealthMonitor
impl Sync for HealthMonitor
impl Unpin for HealthMonitor
impl UnwindSafe for HealthMonitor
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more