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

Baggage

Reference for get_all, get_baggage, set_baggage, remove_baggage, clear, and Propagator.

get_all()

Return all baggage entries as a read-only mapping.

def get_all(context=None) -> typing.Mapping:

Parameters

PropType
context?Optional[Context]

OTel context to read from. Defaults to the current Judgment context.

TypeOptional[Context]
DefaultNone

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

PropType
namestr

The baggage key to look up.

Typestr
context?Optional[Context]

OTel context to read from. Defaults to the current Judgment context.

TypeOptional[Context]
DefaultNone

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

PropType
namestr

The baggage key.

Typestr
valueobject

The baggage value (will be stringified for propagation).

Typeobject
context?Optional[Context]

Base context. Defaults to the current Judgment context.

TypeOptional[Context]
DefaultNone

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

PropType
namestr

The baggage key to remove.

Typestr
context?Optional[Context]

Base context. Defaults to the current Judgment context.

TypeOptional[Context]
DefaultNone

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

PropType
context?Optional[Context]

Base context. Defaults to the current Judgment context.

TypeOptional[Context]
DefaultNone

Returns

opentelemetry.context.Context - A new Context with an empty baggage map.

Was this page helpful?