dragon.ai.agent.observability.tracer.Span
- class Span[source]
Bases:
objectA single timed operation in the trace tree.
Attributes
- span_id:
Unique identifier for this span (auto-generated uuid4).
- trace_id:
Shared identifier across all spans in a pipeline run.
- parent_id:
span_idof the parent span, orNonefor root spans. Automatically set bytrace_span()via_current_spanContextVar.- name:
Human-readable label (e.g. agent name, model name, tool name).
- kind:
Classification of this span (
SpanKind).- start_time:
Unix timestamp when the span started.
- end_time:
Unix timestamp when the span ended, or
Nonewhile in-progress.- attributes:
Structured data captured during the span. Uses namespaced keys:
llm.model,tool.name,hitl.approved,agent.id, etc.- error:
Exception string if the span failed, or
None.
- __init__(span_id: str = <factory>, trace_id: str = '', parent_id: str | None = None, name: str = '', kind: SpanKind = SpanKind.TASK, start_time: float = <factory>, end_time: float | None = None, attributes: dict[str, ~typing.Any]=<factory>, error: str | None = None) None
Methods
__init__(span_id, trace_id, parent_id, name, ...)from_dict(d)Reconstruct a Span from a dict (e.g. from JSON).
to_dict()Serialise to a plain dict (JSON-safe).
Attributes