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

# Trace Event • Rust AI Agent SDK

> TraceEvent: Trace event

# TraceEvent

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

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

Trace event

## Fields

| Name             | Type                    | Description     |
| ---------------- | ----------------------- | --------------- |
| `event_type`     | `String`                | Event type      |
| `timestamp`      | `std::time::SystemTime` | Event timestamp |
| `data`           | `HashMap&lt;String`     | Event data      |
| `serde_json`     | `:Value&gt;`            | Event data      |
| `trace_id`       | `Option&lt;String&gt;`  | Trace ID        |
| `span_id`        | `Option&lt;String&gt;`  | Span ID         |
| `parent_span_id` | `Option&lt;String&gt;`  | Parent span ID  |

## Methods

### `new`

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

Create a new trace event

**Parameters:**

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

### `trace_id`

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

Set trace ID

**Parameters:**

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

### `span_id`

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

Set span ID

**Parameters:**

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

### `data`

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

Add data

**Parameters:**

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

## Source

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

***

## Related Documentation

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

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