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
| Name | Type | Description |
|---|---|---|
enabled | bool | Whether telemetry is enabled |
session_id | String | Session ID for correlation |
user_id | Option<String> | User ID (optional) |
properties | std::collections::HashMap<String | Additional properties |
serde_json | :Value> | Additional properties |
Methods
new
fn new() -> SelfCreate a new minimal telemetry instance
with_session_id
fn with_session_id(session_id: impl Into<String>) -> SelfCreate with specific session ID
Parameters:
| Name | Type |
|---|---|
session_id | impl Into<String> |
set_user_id
fn set_user_id(&mut self, user_id: impl Into<String>) -> ()Set user ID
Parameters:
| Name | Type |
|---|---|
user_id | impl Into<String> |
session_id
fn session_id(&self) -> &strGet session ID
user_id
fn user_id(&self) -> Option<&str>Get user ID
is_enabled
fn is_enabled(&self) -> boolCheck 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:
| Name | Type |
|---|---|
key | impl Into<String> |
value | serde_json::Value |
get_property
fn get_property(&self, key: &str) -> Option<&serde_json::Value>Get a property
Parameters:
| Name | Type |
|---|---|
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:
| Name | Type |
|---|---|
event_name | &str |
properties | Option<&serde_json::Value> |
track_agent_start
fn track_agent_start(&self, agent_name: &str, model: &str) -> ()Track agent start
Parameters:
| Name | Type |
|---|---|
agent_name | &str |
model | &str |
track_agent_complete
fn track_agent_complete(&self, agent_name: &str, duration_ms: u64) -> ()Track agent completion
Parameters:
| Name | Type |
|---|---|
agent_name | &str |
duration_ms | u64 |
track_tool_execution
fn track_tool_execution(&self, tool_name: &str, success: bool, duration_ms: u64) -> ()Track tool execution
Parameters:
| Name | Type |
|---|---|
tool_name | &str |
success | bool |
duration_ms | u64 |
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:
| Name | Type |
|---|---|
model | &str |
input_tokens | Option<u32> |
output_tokens | Option<u32> |
duration_ms | u64 |
track_error
fn track_error(&self, error_type: &str, error_message: &str) -> ()Track error
Parameters:
| Name | Type |
|---|---|
error_type | &str |
error_message | &str |
flush
fn flush(&self) -> ()Flush any pending events
cleanup
fn cleanup(&self) -> ()Cleanup resources
Source
View on GitHubpraisonai/src/parity/telemetry_funcs.rs at line 29