# opentelemetry.baggage package

## Subpackages

- opentelemetry.baggage.propagation package
  - Module contents
    - `W3CBaggagePropagator`
      - `W3CBaggagePropagator.extract()`
      - `W3CBaggagePropagator.inject()`
      - `W3CBaggagePropagator.fields`

## Module contents

opentelemetry.baggage.get_all(context=None)

  Returns the name/value pairs in the Baggage

  Parameters:

    context (`Context` | `None`) – The Context to use. If not set, uses current Context

  Return type:

    `Mapping`[`str`, `object`]

  Returns:

    The name/value pairs in the Baggage

opentelemetry.baggage.get_baggage(name, context=None)

  Provides access to the value for a name/value pair in the Baggage

  Parameters:

    - name (`str`) – The name of the value to retrieve

    - context (`Context` | `None`) – The Context to use. If not set, uses current Context

  Return type:

    `object` | `None`

  Returns:

    The value associated with the given name, or null if the given name is not present.

opentelemetry.baggage.set_baggage(name, value, context=None)

  Sets a value in the Baggage

  Parameters:

    - name (`str`) – The name of the value to set

    - value (`object`) – The value to set

    - context (`Context` | `None`) – The Context to use. If not set, uses current Context

  Return type:

    `Context`

  Returns:

    A Context with the value updated

opentelemetry.baggage.remove_baggage(name, context=None)

  Removes a value from the Baggage

  Parameters:

    - name (`str`) – The name of the value to remove

    - context (`Context` | `None`) – The Context to use. If not set, uses current Context

  Return type:

    `Context`

  Returns:

    A Context with the name/value removed

opentelemetry.baggage.clear(context=None)

  Removes all values from the Baggage

  Parameters:

    context (`Context` | `None`) – The Context to use. If not set, uses current Context

  Return type:

    `Context`

  Returns:

    A Context with all baggage entries removed