spans¶
AdalFlow spans module with OpenAI Agents SDK compatible interface.
This module provides span implementations for AdalFlow tracing that follow the OpenAI Agents SDK patterns for maximum compatibility with existing observability backends.
References: - OpenAI Agents SDK: https://github.com/openai/openai-agents-python/blob/main/src/agents/tracing/spans.py
- class Span[source]¶
Bases:
ABC
,Generic
[TSpanData
]- abstract property trace_id: str¶
- abstract property span_id: str¶
- abstract property span_data: TSpanData¶
- abstract start(mark_as_current: bool = False)[source]¶
Start the span.
- Parameters:
mark_as_current – If true, the span will be marked as the current span.
- abstract finish(reset_current: bool = False) None [source]¶
Finish the span.
- Parameters:
reset_current – If true, the span will be reset as the current span.
- abstract property parent_id: str | None¶
- abstract property started_at: str | None¶
- abstract property ended_at: str | None¶
- class NoOpSpan(span_data: TSpanData)[source]¶
Bases:
Span
[TSpanData
]- property trace_id: str¶
- property span_id: str¶
- property span_data: TSpanData¶
- property parent_id: str | None¶
- start(mark_as_current: bool = False)[source]¶
Start the span.
- Parameters:
mark_as_current – If true, the span will be marked as the current span.
- finish(reset_current: bool = False) None [source]¶
Finish the span.
- Parameters:
reset_current – If true, the span will be reset as the current span.
- property started_at: str | None¶
- property ended_at: str | None¶
- class SpanImpl(trace_id: str, span_id: str | None, parent_id: str | None, processor: TracingProcessor, span_data: TSpanData)[source]¶
Bases:
Span
[TSpanData
]- property trace_id: str¶
- property span_id: str¶
- property span_data: TSpanData¶
- property parent_id: str | None¶
- start(mark_as_current: bool = False)[source]¶
Start the span.
- Parameters:
mark_as_current – If true, the span will be marked as the current span.
- finish(reset_current: bool = False) None [source]¶
Finish the span.
- Parameters:
reset_current – If true, the span will be reset as the current span.
- property started_at: str | None¶
- property ended_at: str | None¶