> ## 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.

# Telemetry Event • Rust AI Agent SDK

> TelemetryEvent: A telemetry event.

# TelemetryEvent

> Defined in the [**telemetry**](../modules/telemetry) module.

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

A telemetry event.

## Fields

| Name         | Type                                  | Description              |
| ------------ | ------------------------------------- | ------------------------ |
| `event_type` | `TelemetryEventType`                  | Event type               |
| `timestamp`  | `chrono::DateTime&lt;chrono::Utc&gt;` | Timestamp                |
| `data`       | `HashMap&lt;String`                   | Event data               |
| `serde_json` | `:Value&gt;`                          | Event data               |
| `duration`   | `Option&lt;Duration&gt;`              | Duration (if applicable) |

## Methods

### `new`

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

Create a new event.

**Parameters:**

| Name         | Type                 |
| ------------ | -------------------- |
| `event_type` | `TelemetryEventType` |

### `with_data`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn with_data(mut self, key: impl Into<String>, value: impl Serialize) -> Self
```

Add data.

**Parameters:**

| Name    | Type                      |
| ------- | ------------------------- |
| `key`   | `impl Into&lt;String&gt;` |
| `value` | `impl Serialize`          |

### `with_duration`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn with_duration(mut self, duration: Duration) -> Self
```

Set duration.

**Parameters:**

| Name       | Type       |
| ---------- | ---------- |
| `duration` | `Duration` |

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/telemetry/mod.rs#L337">
  `praisonai/src/telemetry/mod.rs` at line 337
</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>
