OpenTelemetry PHP

BaggageInterface extends ImplicitContextKeyedInterface

Represents a value that can be stored within {@see ContextInterface}.

Tags
see
https://github.com/open-telemetry/opentelemetry-specification/blob/v1.6.1/specification/baggage/api.md#operations

Table of Contents

Methods

activate()  : ScopeInterface
Adds `$this` to the {@see Context::getCurrent() current context} and makes the new {@see Context} the current context.
fromContext()  : BaggageInterface
Returns the {@see API\BaggageInterface} from the provided *$context*, falling back on {@see API\BaggageInterface::getEmpty()} if there is no baggage in the provided context.
getAll()  : iterable<string|int, mixed>
getBuilder()  : BaggageBuilderInterface
Returns a new empty {@see API\BaggageBuilderInterface}.
getCurrent()  : BaggageInterface
Returns the current {@see Baggage} from the current {@see ContextInterface}, falling back on {@see API\BaggageInterface::getEmpty()} if there is no baggage in the current context.
getEmpty()  : BaggageInterface
Returns a new {@see API\BaggageInterface} with no entries.
getEntry()  : Entry|null
getValue()  : mixed
Returns the value from the {@see API\Entry} with the provided *key*.
isEmpty()  : bool
storeInContext()  : ContextInterface
Returns a new {@see ContextInterface} created by setting `$this` into the provided [@see ContextInterface}.
toBuilder()  : BaggageBuilderInterface
Returns a new {@see API\BaggageBuilderInterface} pre-initialized with the contents of `$this`.

Methods

activate()

Adds `$this` to the {@see Context::getCurrent() current context} and makes the new {@see Context} the current context.

public activate() : ScopeInterface

ScopeInterface::detach() MUST be called to properly restore the previous context.

This method is equivalent to Context::getCurrent().with($value).activate();.

Tags
todo:

Update this to suggest using the new helper method way to doing something in a specific context/span.

Return values
ScopeInterface

getCurrent()

Returns the current {@see Baggage} from the current {@see ContextInterface}, falling back on {@see API\BaggageInterface::getEmpty()} if there is no baggage in the current context.

public static getCurrent() : BaggageInterface
Return values
BaggageInterface

getValue()

Returns the value from the {@see API\Entry} with the provided *key*.

public getValue(string $key) : mixed
Parameters
$key : string
Tags
see
getEntry

        
On this page

Search results