JudgmentSpanProcessor
Span processor that manages span lifecycle, state, and batched export.
Extends the OpenTelemetry BatchSpanProcessor with per-span mutable
state (counters, lists), partial-span emission for streaming updates,
and automatic baggage propagation.
Created automatically by Tracer.init(). Use it directly only when
building a custom tracing pipeline.
Attributes
PropType
tracer?Any
Type
AnyDefault
tracerstate_set()
Store a value in the mutable state for a span.
def state_set(span_context, key, value) -> None:
Parameters
PropType
span_contextSpanContext
Type
SpanContextkeystr
Type
strvalueAny
Type
AnyReturns
None
state_get()
Retrieve a value from the mutable state for a span.
def state_get(span_context, key, default=None) -> Any:
Parameters
PropType
span_contextSpanContext
Type
SpanContextkeystr
Type
strdefault?Any
Type
AnyDefault
NoneReturns
Any
state_incr()
Atomically increment a counter. Returns the value before increment.
def state_incr(span_context, key) -> int:
Parameters
PropType
span_contextSpanContext
Type
SpanContextkeystr
Type
strReturns
int
state_append()
Atomically append to a list. Returns the new list.
def state_append(span_context, key, item) -> list[Any]:
Parameters
PropType
span_contextSpanContext
Type
SpanContextkeystr
Type
stritemAny
Type
AnyReturns
list[Any]
emit_partial()
Export the current span’s in-progress state for streaming updates.
def emit_partial() -> None:
Returns
None
on_start()
def on_start(span, parent_context=None) -> None:
Parameters
PropType
spanSpan
Type
Spanparent_context?Optional[Context]
Type
Optional[Context]Default
NoneReturns
None
on_end()
def on_end(span) -> None:
Parameters
PropType
spanReadableSpan
Type
ReadableSpanReturns
None