Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
PerformanceMonitor
Defined in the telemetry module.
Rust AI Agent SDK
Performance monitor for tracking function and API performance.
Fields
| Name | Type | Description |
|---|
functions | Arc<RwLock<HashMap<String | Function statistics |
apis | Arc<RwLock<HashMap<String | API statistics |
start_time | Instant | Start time |
enabled | bool | Whether monitoring is enabled |
Methods
new
Create a new monitor.
enable
fn enable(&mut self) -> ()
Enable monitoring.
disable
fn disable(&mut self) -> ()
Disable monitoring.
is_enabled
fn is_enabled(&self) -> bool
Check if enabled.
track_function
fn track_function(&self, name: &str, duration: Duration) -> ()
Track a function call.
Parameters:
| Name | Type |
|---|
name | &str |
duration | Duration |
track_api
fn track_api(&self, endpoint: &str, duration: Duration, success: bool, status_code: Option<u16>) -> ()
Track an API call.
Parameters:
| Name | Type |
|---|
endpoint | &str |
duration | Duration |
success | bool |
status_code | Option<u16> |
get_function_stats
fn get_function_stats(&self, name: &str) -> Option<FunctionStats>
Get function stats.
Parameters:
get_api_stats
fn get_api_stats(&self, endpoint: &str) -> Option<ApiStats>
Get API stats.
Parameters:
all_function_stats
fn all_function_stats(&self) -> Vec<FunctionStats>
Get all function stats.
all_api_stats
fn all_api_stats(&self) -> Vec<ApiStats>
Get all API stats.
slowest_functions
fn slowest_functions(&self, limit: usize) -> Vec<FunctionStats>
Get slowest functions.
Parameters:
slowest_apis
fn slowest_apis(&self, limit: usize) -> Vec<ApiStats>
Get slowest APIs.
Parameters:
elapsed
fn elapsed(&self) -> Duration
Get elapsed time since start.
clear
Clear all data.
get_report
fn get_report(&self) -> PerformanceReport
Get performance report.
Source
View on GitHub
praisonai/src/telemetry/mod.rs at line 164