pub struct ToolPerformanceMetrics {
pub execution_count: u64,
pub total_execution_time: Duration,
pub average_execution_time: Duration,
pub min_execution_time: Duration,
pub max_execution_time: Duration,
pub success_count: u64,
pub error_count: u64,
pub success_rate: f64,
pub last_execution: Option<DateTime<Utc>>,
pub recent_execution_times: Vec<Duration>,
}
Expand description
Performance metrics for tool execution tracking
Fields§
§execution_count: u64
Total number of executions
total_execution_time: Duration
Total execution time across all calls
average_execution_time: Duration
Average execution time
min_execution_time: Duration
Minimum execution time recorded
max_execution_time: Duration
Maximum execution time recorded
success_count: u64
Number of successful executions
error_count: u64
Number of failed executions
success_rate: f64
Success rate as percentage (0.0 to 100.0)
last_execution: Option<DateTime<Utc>>
Last execution timestamp
recent_execution_times: Vec<Duration>
Recent execution times (last 10 executions)
Implementations§
Source§impl ToolPerformanceMetrics
impl ToolPerformanceMetrics
Sourcepub fn record_success(&mut self, execution_time: Duration)
pub fn record_success(&mut self, execution_time: Duration)
Record a successful execution
Sourcepub fn record_error(&mut self, execution_time: Duration)
pub fn record_error(&mut self, execution_time: Duration)
Record a failed execution
Sourcepub fn recent_average_execution_time(&self) -> Duration
pub fn recent_average_execution_time(&self) -> Duration
Get recent average execution time (last 10 executions)
Trait Implementations§
Source§impl Clone for ToolPerformanceMetrics
impl Clone for ToolPerformanceMetrics
Source§fn clone(&self) -> ToolPerformanceMetrics
fn clone(&self) -> ToolPerformanceMetrics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ToolPerformanceMetrics
impl Debug for ToolPerformanceMetrics
Source§impl Default for ToolPerformanceMetrics
impl Default for ToolPerformanceMetrics
Source§impl<'de> Deserialize<'de> for ToolPerformanceMetrics
impl<'de> Deserialize<'de> for ToolPerformanceMetrics
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ToolPerformanceMetrics
impl RefUnwindSafe for ToolPerformanceMetrics
impl Send for ToolPerformanceMetrics
impl Sync for ToolPerformanceMetrics
impl Unpin for ToolPerformanceMetrics
impl UnwindSafe for ToolPerformanceMetrics
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