OpenTelemetry PHP

ContextInterface

Immutable execution scoped propagation mechanism.

Tags
see
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/context/README.md#context

Table of Contents

Methods

activate()  : ScopeInterface
Attaches this context as active context.
createKey()  : ContextKeyInterface
Creates a new context key.
get()  : T|null
Returns the value assigned to the given key.
getCurrent()  : ContextInterface
Returns the current context.
with()  : ContextInterface
Returns a context with the given key set to the given value.
withContextValue()  : ContextInterface
Returns a context with the given value set.

Methods

activate()

Attaches this context as active context.

public activate() : ScopeInterface

The returned scope has to be ed. In most cases this should be done using a try-finally statement:

$scope = $context->activate();
try {
    // ...
} finally {
    $scope->detach();
}
Tags
see
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/context/README.md#attach-context
Return values
ScopeInterface

scope to detach the context and restore the previous context


        
On this page

Search results