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

Breadcrumb

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

function AlwaysOffSampler::shouldSample

Returns false because we never want to sample.

Overrides SamplerInterface::shouldSample

File

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

Class

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

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::DROP, [], $traceState);
}

API Navigation

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