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

# ADKSpanProcessor

> Span processor that backfills session identity onto ADK root spans.

Span processor that backfills `gen_ai.conversation.id` onto the root ADK span.

Extends `FiddlerSpanProcessor` (from `fiddler-otel`). ADK sets
`gen_ai.conversation.id` only on child spans (`invoke_agent`, `call_llm`, etc.);
the root `invocation` span gets no attributes. This processor copies the
conversation ID onto the still-open root span when the first child carrying it
ends.

All other enrichment (span-type classification, agent ID computation, content
extraction, attribute normalization) is delegated to the Fiddler backend.

## Example

```python theme={null}
from fiddler_adk import ADKSpanProcessor

# Typically used via GoogleADKInstrumentor, which adds it automatically.
# Direct usage is for advanced custom pipeline setups:
from opentelemetry.sdk.trace import TracerProvider

provider = TracerProvider()
provider.add_span_processor(ADKSpanProcessor())
```

## Inherits

* `FiddlerSpanProcessor` (from `fiddler-otel`)

## Behavior

### on\_start(span, parent\_context)

Tracks root spans (spans with no parent) by their `trace_id`. This allows
the processor to backfill session identity when a child span ends.

### on\_end(span)

When a child span ends:

1. If the child carries `gen_ai.conversation.id` and the root span for that
   trace is still recording, copies the conversation ID onto the root.
2. When the root span itself ends, removes it from tracking.

The first child with a conversation ID wins -- subsequent children do not
overwrite it.

### force\_flush()

Delegates to the parent `FiddlerSpanProcessor.force_flush()`.

### Returns

<ResponseField type="bool">
  `True` if flush completed successfully.
</ResponseField>
