pub struct MetricsCollector { /* private fields */ }
Expand description
Global metrics collector instance
Implementations§
Source§impl MetricsCollector
impl MetricsCollector
Sourcepub fn with_persistence(
persistence_config: PersistenceConfig,
) -> Result<Self, Error>
pub fn with_persistence( persistence_config: PersistenceConfig, ) -> Result<Self, Error>
Create a new metrics collector with persistence
Sourcepub async fn enable_persistence(
&self,
_persistence_config: PersistenceConfig,
) -> Result<(), Error>
pub async fn enable_persistence( &self, _persistence_config: PersistenceConfig, ) -> Result<(), Error>
Enable persistence for this metrics collector
Sourcepub async fn save_snapshot(&self) -> Result<(), Error>
pub async fn save_snapshot(&self) -> Result<(), Error>
Save current metrics snapshot to persistence
Sourcepub async fn record_request_start(&self, tool_name: &str)
pub async fn record_request_start(&self, tool_name: &str)
Record a request start
Sourcepub async fn record_request_end(
&self,
tool_name: &str,
duration: Duration,
success: bool,
)
pub async fn record_request_end( &self, tool_name: &str, duration: Duration, success: bool, )
Record a request completion
Sourcepub async fn record_rate_limit_hit(&self)
pub async fn record_rate_limit_hit(&self)
Record a rate limit hit
Sourcepub async fn record_error<E: ErrorClassification>(
&self,
tool_name: &str,
request_id: &str,
error: &E,
duration: Duration,
)
pub async fn record_error<E: ErrorClassification>( &self, tool_name: &str, request_id: &str, error: &E, duration: Duration, )
Record an error
Sourcepub async fn record_device_operation(
&self,
device_type: Option<&str>,
room_name: Option<&str>,
success: bool,
)
pub async fn record_device_operation( &self, device_type: Option<&str>, room_name: Option<&str>, success: bool, )
Record a device operation
Sourcepub async fn record_loxone_api_call(&self, success: bool)
pub async fn record_loxone_api_call(&self, success: bool)
Record a Loxone API call
Sourcepub async fn record_schema_validation(&self, success: bool)
pub async fn record_schema_validation(&self, success: bool)
Record schema validation
Sourcepub async fn update_health_metrics(
&self,
cpu_usage: Option<f64>,
memory_usage_mb: Option<f64>,
loxone_latency_ms: Option<f64>,
health_check_success: bool,
)
pub async fn update_health_metrics( &self, cpu_usage: Option<f64>, memory_usage_mb: Option<f64>, loxone_latency_ms: Option<f64>, health_check_success: bool, )
Update health metrics
Sourcepub async fn get_metrics_snapshot(&self) -> MetricsSnapshot
pub async fn get_metrics_snapshot(&self) -> MetricsSnapshot
Get comprehensive metrics snapshot
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MetricsCollector
impl !RefUnwindSafe for MetricsCollector
impl Send for MetricsCollector
impl Sync for MetricsCollector
impl Unpin for MetricsCollector
impl !UnwindSafe for MetricsCollector
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