Minimal Telemetry • Rust AI Agent SDK

MinimalTelemetry: Minimal telemetry implementation Provides basic telemetry functionality with minimal overhead. When performance mode is enabled, telemetry operations…

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

rust
fn new() -> Self

Create a new minimal telemetry instance

with_session_id

rust
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

rust
fn set_user_id(&mut self, user_id: impl Into<String>) -> ()

Set user ID

Parameters:

NameType
user_idimpl Into&lt;String&gt;

session_id

rust
fn session_id(&self) -> &str

Get session ID

user_id

rust
fn user_id(&self) -> Option<&str>

Get user ID

is_enabled

rust
fn is_enabled(&self) -> bool

Check if telemetry is enabled

enable

rust
fn enable(&mut self) -> ()

Enable telemetry

disable

rust
fn disable(&mut self) -> ()

Disable telemetry

set_property

rust
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

rust
fn get_property(&self, key: &str) -> Option<&serde_json::Value>

Get a property

Parameters:

NameType
key&str

track_event

rust
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

rust
fn track_agent_start(&self, agent_name: &str, model: &str) -> ()

Track agent start

Parameters:

NameType
agent_name&str
model&str

track_agent_complete

rust
fn track_agent_complete(&self, agent_name: &str, duration_ms: u64) -> ()

Track agent completion

Parameters:

NameType
agent_name&str
duration_msu64

track_tool_execution

rust
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

rust
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

rust
fn track_error(&self, error_type: &str, error_message: &str) -> ()

Track error

Parameters:

NameType
error_type&str
error_message&str

flush

rust
fn flush(&self) -> ()

Flush any pending events

cleanup

rust
fn cleanup(&self) -> ()

Cleanup resources

Source

View on GitHub

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


Related Documentation