Skip to content
Judgment Labs
Esc
↑↓navigate↵open⌘Jpreview
On this page

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
TypeAny
Defaulttracer

state_set()

Store a value in the mutable state for a span.

def state_set(span_context, key, value) -> None:

Parameters

PropType
span_contextSpanContext
TypeSpanContext
keystr
Typestr
valueAny
TypeAny

Returns

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
TypeSpanContext
keystr
Typestr
default?Any
TypeAny
DefaultNone

Returns

Any


state_incr()

Atomically increment a counter. Returns the value before increment.

def state_incr(span_context, key) -> int:

Parameters

PropType
span_contextSpanContext
TypeSpanContext
keystr
Typestr

Returns

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
TypeSpanContext
keystr
Typestr
itemAny
TypeAny

Returns

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
TypeSpan
parent_context?Optional[Context]
TypeOptional[Context]
DefaultNone

Returns

None


on_end()

def on_end(span) -> None:

Parameters

PropType
spanReadableSpan
TypeReadableSpan

Returns

None

Was this page helpful?