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

Breadcrumb

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

function AlwaysOnSampler::shouldSample

Returns true because we always want to sample.

Overrides SamplerInterface::shouldSample

File

vendor/open-telemetry/sdk/Trace/Sampler/AlwaysOnSampler.php, line 27

Class

AlwaysOnSampler
This implementation of the SamplerInterface always records. Example: ``` use OpenTelemetry\Sdk\Trace\AlwaysOnSampler; $sampler = new AlwaysOnSampler(); ```

Namespace

OpenTelemetry\SDK\Trace\Sampler

Code

public function shouldSample(ContextInterface $parentContext, string $traceId, string $spanName, int $spanKind, AttributesInterface $attributes, array $links) : SamplingResult {
    $parentSpan = Span::fromContext($parentContext);
    $parentSpanContext = $parentSpan->getContext();
    $traceState = $parentSpanContext->getTraceState();
    return new SamplingResult(SamplingResult::RECORD_AND_SAMPLE, [], $traceState);
}

API Navigation

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