Skip to main content

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

NameTypeDescription
functionsArc<RwLock<HashMap<StringFunction statistics
apisArc<RwLock<HashMap<StringAPI statistics
start_timeInstantStart time
enabledboolWhether monitoring is enabled

Methods

new

fn new() -> Self
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:
NameType
name&str
durationDuration

track_api

fn track_api(&self, endpoint: &str, duration: Duration, success: bool, status_code: Option<u16>) -> ()
Track an API call. Parameters:
NameType
endpoint&str
durationDuration
successbool
status_codeOption&lt;u16&gt;

get_function_stats

fn get_function_stats(&self, name: &str) -> Option<FunctionStats>
Get function stats. Parameters:
NameType
name&str

get_api_stats

fn get_api_stats(&self, endpoint: &str) -> Option<ApiStats>
Get API stats. Parameters:
NameType
endpoint&str

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:
NameType
limitusize

slowest_apis

fn slowest_apis(&self, limit: usize) -> Vec<ApiStats>
Get slowest APIs. Parameters:
NameType
limitusize

elapsed

fn elapsed(&self) -> Duration
Get elapsed time since start.

clear

fn clear(&self) -> ()
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