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

# FiddlerSpan

> Wrapper around OpenTelemetry span with simplified helper methods.

> [!NOTE]
>
> Re-exported from [`fiddler_otel.span_wrapper.FiddlerSpan`](https://docs.fiddler.ai/sdk-api/otel/fiddler-span).

Initialize wrapper around an OTel span or context manager.

## Parameters

**span\_or\_context** `Any` *required*

An OTel span or context manager.

**media\_uploader** `Any` (default: None)

Optional `MediaUploader`
for normalizing large base64 content before span export.

## `__enter__()`

Enter context manager and start span.

### Returns

`FiddlerSpan`

## `__exit__()`

Exit context manager, record exceptions, and end span.

### Returns

`Literal[False]`

## end()

Explicitly end the span. Must be called when using start\_span().

## set\_input()

Set input data. Auto-serializes dicts/lists to JSON.

## set\_output()

Set output data. Auto-serializes dicts/lists to JSON.

## set\_attribute()

Set a custom attribute on the span.

## update()

Bulk update multiple attributes.

## record\_exception()

Record an exception on the span.

## set\_agent\_name()

Set the agent name (gen\_ai.agent.name).

## set\_agent\_id()

Set the agent ID (gen\_ai.agent.id).

## set\_conversation\_id()

Set the conversation ID (gen\_ai.conversation.id).

> [!NOTE]
>
> See the [canonical reference](https://docs.fiddler.ai/sdk-api/otel/fiddler-span.md) for the full description and examples.
