ReadWriteSpanInterface
extends
SpanInterface, ReadableSpanInterface
in
Represents a value that can be stored within {@see ContextInterface}.
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.
- getAttribute() : mixed
- Returns the value of the attribute with the provided *key*.
- 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.
- getDuration() : int
- Returns the duration of the {@see API\SpanInterface} in nanoseconds.
- getInstrumentationScope() : InstrumentationScopeInterface
- getInvalid() : SpanInterface
- Returns an invalid {@see SpanInterface} that is used when tracing is disabled, such s when there is no available SDK.
- getKind() : int
- getName() : string
- getParentContext() : SpanContextInterface
- hasEnded() : bool
- 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}.
- toSpanData() : SpanDataInterface
- Returns an immutable representation of this instance.
- 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
SpanInterfacegetAttribute()
Returns the value of the attribute with the provided *key*.
public
getAttribute(string $key) : mixed
Returns null
if there are no attributes set, or no attribute with that key exists.
Parameters
- $key : string
getContext()
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
SpanInterfacegetDuration()
Returns the duration of the {@see API\SpanInterface} in nanoseconds.
public
getDuration() : int
If still active, returns now() - start
.
Return values
intgetInstrumentationScope()
public
getInstrumentationScope() : InstrumentationScopeInterface
Return values
InstrumentationScopeInterfacegetInvalid()
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
SpanInterfacegetKind()
public
getKind() : int
Tags
Return values
intgetName()
public
getName() : string
Return values
stringgetParentContext()
public
getParentContext() : SpanContextInterface
Return values
SpanContextInterfacehasEnded()
public
hasEnded() : bool
Return values
boolisRecording()
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
ContextInterfacetoSpanData()
Returns an immutable representation of this instance.
public
toSpanData() : SpanDataInterface
Return values
SpanDataInterfaceupdateName()
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