pub struct StartedRootTurnSpan {
pub span: BoxedSpan,
pub trace_id_hex: String,
pub span_id_hex: String,
pub sampled: bool,
}otel only.Expand description
A started root-turn span plus the hex ids the worker persists so the turn’s later tasks can re-parent their spans under it.
Fields§
§span: BoxedSpanThe live invoke_agent span.
Canonical lifecycle: hand this span straight to
stash_root_turn_span (keyed by task id) and finalize it later —
from whichever task reaches the terminal — via
finalize_root_turn_span, so the exported span carries the
full turn duration across the suspend/resume hop. Only callers
that deliberately opt out of the registry hold this span directly
and finish it with finish_root_turn_span (or let it end on drop,
which truncates the duration to the fresh segment only).
trace_id_hex: StringHex-encoded TraceId — persist to
agent_sdk_turn_attempts.otel_trace_id.
span_id_hex: StringHex-encoded root SpanId — persist to
agent_sdk_turn_attempts.otel_span_id.
sampled: boolThe root span’s real sampled bit, captured from its SpanContext
at creation.
Persist this alongside the ids and pass it to
remote_parent_context_with_sampling /
traceparent_from_ids_with_sampling when re-parenting resumed
chat calls and child execute_tool spans, so those children
honour ratio sampling instead of being force-recorded under a
sampled-out root.