Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SamplerInterface.php

function SamplerInterface::shouldSample

Returns SamplingResult.

Parameters

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

string $traceId 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.

string $spanName Name of the Span to be created.:

int $spanKind Span kind.:

AttributesInterface $attributes Initial set of Attributes for the Span being constructed.:

list<LinkInterface> $links 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/mast…

Return value

SamplingResult

4 methods override SamplerInterface::shouldSample()
AlwaysOffSampler::shouldSample in vendor/open-telemetry/sdk/Trace/Sampler/AlwaysOffSampler.php
Returns false because we never want to sample.
AlwaysOnSampler::shouldSample in vendor/open-telemetry/sdk/Trace/Sampler/AlwaysOnSampler.php
Returns true because we always want to sample.
ParentBased::shouldSample in vendor/open-telemetry/sdk/Trace/Sampler/ParentBased.php
Invokes the respective delegate sampler when parent is set or uses root sampler for the root span.
TraceIdRatioBasedSampler::shouldSample in vendor/open-telemetry/sdk/Trace/Sampler/TraceIdRatioBasedSampler.php
Returns `SamplingResult` based on probability. Respects the parent `SampleFlag`

File

vendor/open-telemetry/sdk/Trace/SamplerInterface.php, line 31

Class

SamplerInterface
This interface is used to organize sampling logic.

Namespace

OpenTelemetry\SDK\Trace

Code

public function shouldSample(ContextInterface $parentContext, string $traceId, string $spanName, int $spanKind, AttributesInterface $attributes, array $links) : SamplingResult;

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal