JudgmentBaggageProcessor
Copies OTel baggage entries onto span attributes at span start.
PropType
BaggageKeyPredicateT?Any
Predicate that decides which baggage keys are propagated to span attributes.
Type
AnyDefault
Callable[[str], bool]ALLOW_ALL_BAGGAGE_KEYS?BaggageKeyPredicateT
Default predicate that allows every baggage key.
Type
BaggageKeyPredicateTDefault
lambda _: TrueCopies 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
PropType
baggage_key_predicate?BaggageKeyPredicateT
Type
BaggageKeyPredicateTDefault
ALLOW_ALL_BAGGAGE_KEYSReturns
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
shutdown()
def shutdown() -> None:
Returns
None
force_flush()
def force_flush(timeout_millis=30000) -> bool:
Parameters
PropType
timeout_millis?int
Type
intDefault
30000Returns
bool