Skip to main content
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

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

True if flush completed successfully.