pub struct PerformanceMonitor { /* private fields */ }
Expand description
Performance metrics collector and monitor
Implementations§
Source§impl PerformanceMonitor
impl PerformanceMonitor
Sourcepub fn new(config: MonitoringConfig) -> Self
pub fn new(config: MonitoringConfig) -> Self
Create a new performance monitor
Sourcepub async fn start(&mut self) -> Result<UnboundedReceiver<Alert>>
pub async fn start(&mut self) -> Result<UnboundedReceiver<Alert>>
Start the monitoring system
Sourcepub fn record_tool_execution(
&self,
tool_name: &str,
duration: Duration,
success: bool,
client_type: Option<&str>,
payload_size: usize,
)
pub fn record_tool_execution( &self, tool_name: &str, duration: Duration, success: bool, client_type: Option<&str>, payload_size: usize, )
Record a tool execution
Sourcepub fn record_error(
&self,
tool_name: &str,
error_type: ErrorType,
error_message: &str,
severity: ErrorSeverity,
client_type: Option<&str>,
)
pub fn record_error( &self, tool_name: &str, error_type: ErrorType, error_message: &str, severity: ErrorSeverity, client_type: Option<&str>, )
Record an error
Sourcepub fn get_performance_summary(&self) -> Result<PerformanceSummary>
pub fn get_performance_summary(&self) -> Result<PerformanceSummary>
Get current performance summary
Sourcepub async fn export_metrics(&self) -> Result<()>
pub async fn export_metrics(&self) -> Result<()>
Export metrics to file
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PerformanceMonitor
impl RefUnwindSafe for PerformanceMonitor
impl Send for PerformanceMonitor
impl Sync for PerformanceMonitor
impl Unpin for PerformanceMonitor
impl UnwindSafe for PerformanceMonitor
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