Baggage
get_all()
Return all baggage entries as a read-only mapping.
def get_all(context=None) -> typing.Mapping:Parameters
context
:Optional[Context]
OTel context to read from. Defaults to the current Judgment context.
None
Returns
typing.Mapping - An immutable mapping of baggage key-value pairs.
get_baggage()
Retrieve a single baggage value by key.
def get_baggage(name, context=None) -> typing.Optional:Parameters
name
required:str
The baggage key to look up.
context
:Optional[Context]
OTel context to read from. Defaults to the current Judgment context.
None
Returns
typing.Optional - The baggage value, or None if the key is not set.
set_baggage()
Set a baggage key-value pair, returning a new context with the entry.
def set_baggage(name, value, context=None) -> opentelemetry.context.Context:Parameters
name
required:str
The baggage key.
value
required:object
The baggage value (will be stringified for propagation).
context
:Optional[Context]
Base context. Defaults to the current Judgment context.
None
Returns
opentelemetry.context.Context - A new Context containing the updated baggage.
remove_baggage()
Remove a baggage entry by key, returning a new context without it.
def remove_baggage(name, context=None) -> opentelemetry.context.Context:Parameters
name
required:str
The baggage key to remove.
context
:Optional[Context]
Base context. Defaults to the current Judgment context.
None
Returns
opentelemetry.context.Context - A new Context with the entry removed.
clear()
Remove all baggage entries, returning a clean context.
def clear(context=None) -> opentelemetry.context.Context:Parameters
context
:Optional[Context]
Base context. Defaults to the current Judgment context.
None
Returns
opentelemetry.context.Context - A new Context with an empty baggage map.