pub struct SystemMonitor { /* private fields */ }Expand description
System monitor for health checks and metrics collection
Implementations§
Source§impl SystemMonitor
impl SystemMonitor
Sourcepub fn new(config: MonitorConfig) -> Self
pub fn new(config: MonitorConfig) -> Self
Create a new system monitor
Sourcepub async fn start_monitoring(&self) -> JoinHandle<()>
pub async fn start_monitoring(&self) -> JoinHandle<()>
Start monitoring (both metrics and health checks)
Sourcepub async fn stop_monitoring(&self)
pub async fn stop_monitoring(&self)
Stop monitoring
Sourcepub async fn start_health_monitoring(&self) -> JoinHandle<()>
pub async fn start_health_monitoring(&self) -> JoinHandle<()>
Start health monitoring background task
Returns a JoinHandle to the spawned health monitoring task that periodically checks system health
Sourcepub async fn get_system_metrics(&self) -> SystemMetrics
pub async fn get_system_metrics(&self) -> SystemMetrics
Collect current metrics
Sourcepub async fn check_health(&self) -> Vec<HealthCheck>
pub async fn check_health(&self) -> Vec<HealthCheck>
Check system health
Sourcepub async fn get_health_checks(&self) -> Vec<HealthCheck>
pub async fn get_health_checks(&self) -> Vec<HealthCheck>
Get latest stored health checks
Sourcepub async fn get_app_metrics(&self) -> ApplicationMetrics
pub async fn get_app_metrics(&self) -> ApplicationMetrics
Get application metrics
Sourcepub async fn update_app_metrics<F>(&self, updater: F)where
F: FnOnce(&mut ApplicationMetrics),
pub async fn update_app_metrics<F>(&self, updater: F)where
F: FnOnce(&mut ApplicationMetrics),
Update application metrics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SystemMonitor
impl !RefUnwindSafe for SystemMonitor
impl Send for SystemMonitor
impl Sync for SystemMonitor
impl Unpin for SystemMonitor
impl !UnwindSafe for SystemMonitor
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