SpanBuilder
in package
implements
SpanBuilderInterface
FinalYes
Table of Contents
Interfaces
- SpanBuilderInterface
- Obtained from a {@see TracerInterface} and used to construct a {@see SpanInterface}.
Properties
- $attributesBuilder : AttributesBuilderInterface
- $instrumentationScope : InstrumentationScopeInterface
- $links : array<int, LinkInterface>
- $parentContext : ContextInterface|false|null
- $spanKind : int
- $spanName : string
- $startEpochNanos : int
- $totalNumberOfLinksAdded : int
- $tracerSharedState : TracerSharedState
Methods
- __construct() : mixed
- addLink() : SpanBuilderInterface
- setAttribute() : SpanBuilderInterface
- setAttributes() : SpanBuilderInterface
- setParent() : SpanBuilderInterface
- Sets the parent `Context`.
- setSpanKind() : SpanBuilderInterface
- setStartTimestamp() : SpanBuilderInterface
- Sets an explicit start timestamp for the newly created {@see SpanInterface}.
- startSpan() : SpanInterface
- Starts and returns a new {@see SpanInterface}.
Properties
$attributesBuilder
private
AttributesBuilderInterface
$attributesBuilder
$instrumentationScope read-only
private
InstrumentationScopeInterface
$instrumentationScope
$links
private
array<int, LinkInterface>
$links
= []
$parentContext
private
ContextInterface|false|null
$parentContext
= null
$spanKind
private
int
$spanKind
= \OpenTelemetry\API\Trace\SpanKind::KIND_INTERNAL
Tags
$spanName read-only
private
string
$spanName
$startEpochNanos
private
int
$startEpochNanos
= 0
$totalNumberOfLinksAdded
private
int
$totalNumberOfLinksAdded
= 0
$tracerSharedState read-only
private
TracerSharedState
$tracerSharedState
Methods
__construct()
public
__construct(non-empty-string $spanName, InstrumentationScopeInterface $instrumentationScope, TracerSharedState $tracerSharedState) : mixed
Parameters
- $spanName : non-empty-string
- $instrumentationScope : InstrumentationScopeInterface
- $tracerSharedState : TracerSharedState
addLink()
public
addLink(SpanContextInterface $context[, iterable<string|int, mixed> $attributes = [] ]) : SpanBuilderInterface
Parameters
- $context : SpanContextInterface
- $attributes : iterable<string|int, mixed> = []
Tags
Return values
SpanBuilderInterfacesetAttribute()
public
setAttribute(string $key, mixed $value) : SpanBuilderInterface
Parameters
- $key : string
- $value : mixed
Tags
Return values
SpanBuilderInterfacesetAttributes()
public
setAttributes(iterable<string|int, mixed> $attributes) : SpanBuilderInterface
Parameters
- $attributes : iterable<string|int, mixed>
Tags
Return values
SpanBuilderInterfacesetParent()
Sets the parent `Context`.
public
setParent(ContextInterface|false|null $context) : SpanBuilderInterface
Parameters
- $context : ContextInterface|false|null
-
the parent context, null to use the current context, false to set no parent
Tags
Return values
SpanBuilderInterface —this span builder
setSpanKind()
public
setSpanKind(int $spanKind) : SpanBuilderInterface
Parameters
- $spanKind : int
Tags
Return values
SpanBuilderInterfacesetStartTimestamp()
Sets an explicit start timestamp for the newly created {@see SpanInterface}.
public
setStartTimestamp(int $timestampNanos) : SpanBuilderInterface
Parameters
- $timestampNanos : int
Tags
Return values
SpanBuilderInterfacestartSpan()
Starts and returns a new {@see SpanInterface}.
public
startSpan() : SpanInterface