SpanInterface
extends
ImplicitContextKeyedInterface
in
Represents a value that can be stored within {@see ContextInterface}.
Tags
Table of Contents
Methods
- activate() : ScopeInterface
- Adds `$this` to the {@see Context::getCurrent() current context} and makes the new {@see Context} the current context.
- addEvent() : SpanInterface
- addLink() : SpanInterface
- Records a link to another `SpanContext`.
- end() : void
- fromContext() : SpanInterface
- Returns the {@see SpanInterface} from the provided *$context*, falling back on {@see SpanInterface::getInvalid()} if there is no span in the provided context.
- getContext() : SpanContextInterface
- getCurrent() : SpanInterface
- Returns the current {@see SpanInterface} from the current {@see ContextInterface}, falling back on {@see SpanInterface::getEmpty()} if there is no span in the current context.
- getInvalid() : SpanInterface
- Returns an invalid {@see SpanInterface} that is used when tracing is disabled, such s when there is no available SDK.
- isRecording() : bool
- recordException() : SpanInterface
- setAttribute() : SpanInterface
- setAttributes() : SpanInterface
- setStatus() : SpanInterface
- storeInContext() : ContextInterface
- Returns a new {@see ContextInterface} created by setting `$this` into the provided [@see ContextInterface}.
- updateName() : SpanInterface
- wrap() : SpanInterface
- Returns a non-recording {@see SpanInterface} that hold the provided *$spanContext* but has no functionality.
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
Return values
ScopeInterfaceaddEvent()
public
addEvent(string $name[, iterable<string|int, mixed> $attributes = [] ][, int|null $timestamp = null ]) : SpanInterface
Parameters
- $name : string
- $attributes : iterable<string|int, mixed> = []
- $timestamp : int|null = null
Tags
Return values
SpanInterfaceaddLink()
Records a link to another `SpanContext`.
public
addLink(SpanContextInterface $context[, iterable<string|int, mixed> $attributes = [] ]) : SpanInterface
Adding links at span creation via is preferred to calling later, for contexts that are available during span creation, because head sampling decisions can only consider information present during span creation.
Parameters
- $context : SpanContextInterface
-
span context to link
- $attributes : iterable<string|int, mixed> = []
-
attributes to associate with the link
Tags
Return values
SpanInterface —this span
end()
public
end([int|null $endEpochNanos = null ]) : void
Parameters
- $endEpochNanos : int|null = null
Tags
fromContext()
Returns the {@see SpanInterface} from the provided *$context*, falling back on {@see SpanInterface::getInvalid()} if there is no span in the provided context.
public
static fromContext(ContextInterface $context) : SpanInterface
Parameters
- $context : ContextInterface
Return values
SpanInterfacegetContext()
public
getContext() : SpanContextInterface
Tags
Return values
SpanContextInterfacegetCurrent()
Returns the current {@see SpanInterface} from the current {@see ContextInterface}, falling back on {@see SpanInterface::getEmpty()} if there is no span in the current context.
public
static getCurrent() : SpanInterface
Return values
SpanInterfacegetInvalid()
Returns an invalid {@see SpanInterface} that is used when tracing is disabled, such s when there is no available SDK.
public
static getInvalid() : SpanInterface
Return values
SpanInterfaceisRecording()
public
isRecording() : bool
Tags
Return values
boolrecordException()
public
recordException(Throwable $exception[, iterable<string|int, mixed> $attributes = [] ]) : SpanInterface
Parameters
- $exception : Throwable
- $attributes : iterable<string|int, mixed> = []
Tags
Return values
SpanInterfacesetAttribute()
public
setAttribute(non-empty-string $key, bool|int|float|string|array<string|int, mixed>|null $value) : SpanInterface
Parameters
- $key : non-empty-string
- $value : bool|int|float|string|array<string|int, mixed>|null
-
Note: arrays MUST be homogeneous, i.e. it MUST NOT contain values of different types.
Tags
Return values
SpanInterfacesetAttributes()
public
setAttributes(iterable<non-empty-string, bool|int|float|string|array<string|int, mixed>|null> $attributes) : SpanInterface
Parameters
- $attributes : iterable<non-empty-string, bool|int|float|string|array<string|int, mixed>|null>
Tags
Return values
SpanInterfacesetStatus()
public
setStatus(string $code[, string|null $description = null ]) : SpanInterface
Parameters
- $code : string
- $description : string|null = null
Tags
Return values
SpanInterfacestoreInContext()
Returns a new {@see ContextInterface} created by setting `$this` into the provided [@see ContextInterface}.
public
storeInContext(ContextInterface $context) : ContextInterface
Parameters
- $context : ContextInterface
Return values
ContextInterfaceupdateName()
public
updateName(non-empty-string $name) : SpanInterface
Parameters
- $name : non-empty-string
Tags
Return values
SpanInterfacewrap()
Returns a non-recording {@see SpanInterface} that hold the provided *$spanContext* but has no functionality.
public
static wrap(SpanContextInterface $spanContext) : SpanInterface
It will not be exported and al tracing operations are no-op, but can be used to propagate a valid SpanContext downstream.
Parameters
- $spanContext : SpanContextInterface