pub struct ServerMonitor { /* private fields */ }
Expand description
Monitors the health of running MCP servers.
Periodically checks the status of registered servers and can optionally
trigger restarts based on configuration.
All public methods are instrumented with tracing
spans.
Implementations§
Source§impl ServerMonitor
impl ServerMonitor
Sourcepub fn new(
lifecycle_manager: Arc<ServerLifecycleManager>,
config: ServerMonitorConfig,
) -> Self
pub fn new( lifecycle_manager: Arc<ServerLifecycleManager>, config: ServerMonitorConfig, ) -> Self
Create a new server monitor
This method is instrumented with tracing
.
Sourcepub fn start(&mut self) -> Result<()>
pub fn start(&mut self) -> Result<()>
Start the monitor
This method is instrumented with tracing
.
Sourcepub fn stop(&mut self) -> Result<()>
pub fn stop(&mut self) -> Result<()>
Stop the monitor
This method is instrumented with tracing
.
Sourcepub fn get_health(&self, id: ServerId) -> Result<ServerHealth>
pub fn get_health(&self, id: ServerId) -> Result<ServerHealth>
Get server health
This method is instrumented with tracing
.
Sourcepub async fn check_health(
&self,
id: ServerId,
name: &str,
) -> Result<ServerHealth>
pub async fn check_health( &self, id: ServerId, name: &str, ) -> Result<ServerHealth>
Force health check for a server
This method is instrumented with tracing
.
Sourcepub fn get_all_health(&self) -> Result<HashMap<ServerId, ServerHealth>>
pub fn get_all_health(&self) -> Result<HashMap<ServerId, ServerHealth>>
Get all health statuses
Auto Trait Implementations§
impl Freeze for ServerMonitor
impl RefUnwindSafe for ServerMonitor
impl Send for ServerMonitor
impl Sync for ServerMonitor
impl Unpin for ServerMonitor
impl UnwindSafe for ServerMonitor
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