PythonTracerProcessors

JudgmentBaggageProcessor

Copies OTel baggage entries onto span attributes at span start.

BaggageKeyPredicateT

Predicate that decides which baggage keys are propagated to span attributes.

Default:

Callable[[str], bool]

ALLOW_ALL_BAGGAGE_KEYS

:

BaggageKeyPredicateT

Default predicate that allows every baggage key.

Default:

lambda _: True

Copies OTel baggage entries onto span attributes at span start.

When a span starts, this processor reads all baggage from the parent context and sets matching entries as span attributes. Use baggage_key_predicate to control which keys are propagated.

Allow only Judgment-prefixed baggage keys:

from judgeval.trace.processors import JudgmentBaggageProcessor

processor = JudgmentBaggageProcessor(
    baggage_key_predicate=lambda k: k.startswith("judgment."),
)

__init__()

def __init__(baggage_key_predicate=ALLOW_ALL_BAGGAGE_KEYS) -> None:

Parameters

baggage_key_predicate

:

BaggageKeyPredicateT

Default:

ALLOW_ALL_BAGGAGE_KEYS

Returns

None


on_start()

def on_start(span, parent_context=None) -> None:

Parameters

span

required

:

Span

parent_context

:

Optional[Context]

Default:

None

Returns

None


on_end()

def on_end(span) -> None:

Parameters

span

required

:

ReadableSpan

Returns

None


shutdown()

def shutdown() -> None:

Returns

None


force_flush()

def force_flush(timeout_millis=30000) -> bool:

Parameters

timeout_millis

:

int

Default:

30000

Returns

bool