use anyhow::Result;
impl crate::server::MemoryMCPServer {
pub async fn health_check(&self) -> Result<serde_json::Value> {
self.track_tool_usage("health_check").await;
let request_id = format!(
"health_check_{}",
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
.as_nanos()
);
self.monitoring
.start_request(request_id.clone(), "health_check".to_string())
.await;
let result = self.monitoring_endpoints.health_check().await?;
self.monitoring.end_request(&request_id, true, None).await;
Ok(result)
}
pub async fn get_metrics(&self, metric_type: Option<String>) -> Result<serde_json::Value> {
self.track_tool_usage("get_metrics").await;
let request_id = format!(
"get_metrics_{}",
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
.as_nanos()
);
self.monitoring
.start_request(request_id.clone(), "get_metrics".to_string())
.await;
let result = match metric_type.as_deref() {
Some("performance") => self.monitoring_endpoints.performance_metrics().await,
Some("episodes") => self.monitoring_endpoints.episode_metrics().await,
Some("system") => self.monitoring_endpoints.system_info().await,
_ => self.monitoring_endpoints.metrics().await,
};
self.monitoring
.end_request(&request_id, result.is_ok(), None)
.await;
result
}
}