OpenTelemetry PHP

SamplerInterface

This interface is used to organize sampling logic.

Tags
see
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#sampler

Table of Contents

Methods

getDescription()  : string
Returns the sampler name or short description with the configuration.
shouldSample()  : SamplingResult
Returns SamplingResult.

Methods

getDescription()

Returns the sampler name or short description with the configuration.

public getDescription() : string

This may be displayed on debug pages or in the logs. Example: "TraceIdRatioBasedSampler{0.000100}"

Return values
string

shouldSample()

Returns SamplingResult.

public shouldSample(ContextInterface $parentContext, string $traceId, string $spanName, int $spanKind, AttributesInterface $attributes, array<int, LinkInterface$links) : SamplingResult
Parameters
$parentContext : ContextInterface

Context with parent Span. The Span's SpanContext may be invalid to indicate a root span.

$traceId : string

TraceId of the Span to be created. It can be different from the TraceId in the SpanContext. Typically in situations when the Span to be created starts a new Trace.

$spanName : string

Name of the Span to be created.

$spanKind : int

Span kind.

$attributes : AttributesInterface

Initial set of Attributes for the Span being constructed.

$links : array<int, LinkInterface>

Collection of links that will be associated with the Span to be created. Typically, useful for batch operations. @see https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/overview.md#links-between-spans

Return values
SamplingResult

        
On this page

Search results