Skip to main content

MinimalTelemetry

Defined in the Telemetry Funcs module.
Rust AI Agent SDK Minimal telemetry implementation Provides basic telemetry functionality with minimal overhead. When performance mode is enabled, telemetry operations are no-ops.

Fields

NameTypeDescription
enabledboolWhether telemetry is enabled
session_idStringSession ID for correlation
user_idOption<String>User ID (optional)
propertiesstd::collections::HashMap<StringAdditional properties
serde_json:Value>Additional properties

Methods

new

fn new() -> Self
Create a new minimal telemetry instance

with_session_id

fn with_session_id(session_id: impl Into<String>) -> Self
Create with specific session ID Parameters:
NameType
session_idimpl Into&lt;String&gt;

set_user_id

fn set_user_id(&mut self, user_id: impl Into<String>) -> ()
Set user ID Parameters:
NameType
user_idimpl Into&lt;String&gt;

session_id

fn session_id(&self) -> &str
Get session ID

user_id

fn user_id(&self) -> Option<&str>
Get user ID

is_enabled

fn is_enabled(&self) -> bool
Check if telemetry is enabled

enable

fn enable(&mut self) -> ()
Enable telemetry

disable

fn disable(&mut self) -> ()
Disable telemetry

set_property

fn set_property(&mut self, key: impl Into<String>, value: serde_json::Value) -> ()
Set a property Parameters:
NameType
keyimpl Into&lt;String&gt;
valueserde_json::Value

get_property

fn get_property(&self, key: &str) -> Option<&serde_json::Value>
Get a property Parameters:
NameType
key&str

track_event

fn track_event(&self, event_name: &str, properties: Option<&serde_json::Value>) -> ()
Track an event (no-op if disabled or in performance mode) Parameters:
NameType
event_name&str
propertiesOption&lt;&serde_json::Value&gt;

track_agent_start

fn track_agent_start(&self, agent_name: &str, model: &str) -> ()
Track agent start Parameters:
NameType
agent_name&str
model&str

track_agent_complete

fn track_agent_complete(&self, agent_name: &str, duration_ms: u64) -> ()
Track agent completion Parameters:
NameType
agent_name&str
duration_msu64

track_tool_execution

fn track_tool_execution(&self, tool_name: &str, success: bool, duration_ms: u64) -> ()
Track tool execution Parameters:
NameType
tool_name&str
successbool
duration_msu64

track_llm_call

fn track_llm_call(
        &self,
        model: &str,
        input_tokens: Option<u32>,
        output_tokens: Option<u32>,
        duration_ms: u64,
    ) -> ()
Track LLM call Parameters:
NameType
model&str
input_tokensOption&lt;u32&gt;
output_tokensOption&lt;u32&gt;
duration_msu64

track_error

fn track_error(&self, error_type: &str, error_message: &str) -> ()
Track error Parameters:
NameType
error_type&str
error_message&str

flush

fn flush(&self) -> ()
Flush any pending events

cleanup

fn cleanup(&self) -> ()
Cleanup resources

Source

View on GitHub

praisonai/src/parity/telemetry_funcs.rs at line 29