> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 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**](../modules/telemetry_funcs) module.

<Badge color="orange">Rust AI Agent SDK</Badge>

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&lt;String&gt;`                | User ID (optional)           |
| `properties` | `std::collections::HashMap&lt;String` | Additional properties        |
| `serde_json` | `:Value&gt;`                          | Additional properties        |

## Methods

### `new`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn new() -> Self
```

Create a new minimal telemetry instance

### `with_session_id`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn with_session_id(session_id: impl Into<String>) -> Self
```

Create with specific session ID

**Parameters:**

| Name         | Type                      |
| ------------ | ------------------------- |
| `session_id` | `impl Into&lt;String&gt;` |

### `set_user_id`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn set_user_id(&mut self, user_id: impl Into<String>) -> ()
```

Set user ID

**Parameters:**

| Name      | Type                      |
| --------- | ------------------------- |
| `user_id` | `impl Into&lt;String&gt;` |

### `session_id`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn session_id(&self) -> &str
```

Get session ID

### `user_id`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn user_id(&self) -> Option<&str>
```

Get user ID

### `is_enabled`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn is_enabled(&self) -> bool
```

Check if telemetry is enabled

### `enable`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn enable(&mut self) -> ()
```

Enable telemetry

### `disable`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn disable(&mut self) -> ()
```

Disable telemetry

### `set_property`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn set_property(&mut self, key: impl Into<String>, value: serde_json::Value) -> ()
```

Set a property

**Parameters:**

| Name    | Type                      |
| ------- | ------------------------- |
| `key`   | `impl Into&lt;String&gt;` |
| `value` | `serde_json::Value`       |

### `get_property`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn get_property(&self, key: &str) -> Option<&serde_json::Value>
```

Get a property

**Parameters:**

| Name  | Type   |
| ----- | ------ |
| `key` | `&str` |

### `track_event`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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&lt;&serde_json::Value&gt;` |

### `track_agent_start`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn track_agent_start(&self, agent_name: &str, model: &str) -> ()
```

Track agent start

**Parameters:**

| Name         | Type   |
| ------------ | ------ |
| `agent_name` | `&str` |
| `model`      | `&str` |

### `track_agent_complete`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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&lt;u32&gt;` |
| `output_tokens` | `Option&lt;u32&gt;` |
| `duration_ms`   | `u64`               |

### `track_error`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn track_error(&self, error_type: &str, error_message: &str) -> ()
```

Track error

**Parameters:**

| Name            | Type   |
| --------------- | ------ |
| `error_type`    | `&str` |
| `error_message` | `&str` |

### `flush`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn flush(&self) -> ()
```

Flush any pending events

### `cleanup`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn cleanup(&self) -> ()
```

Cleanup resources

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/parity/telemetry_funcs.rs#L29">
  `praisonai/src/parity/telemetry_funcs.rs` at line 29
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Telemetry" icon="signal" href="/docs/rust/telemetry" />

  <Card title="Rust Tracing" icon="chart-line" href="/docs/rust/tracing" />
</CardGroup>
