NAME

OpenTelemetry::SDK::Trace::Sampler::AlwaysOff - A sampler that will never sample

SYNOPSIS

my $sampler = OpenTelemetry::SDK::Trace::Sampler::AlwaysOff->new;

my $result = $sampler->should_sample( ... );

if ( $result->sampled ) {
    # this will never be reached :(
}

DESCRIPTION

This module provides a sampler whose should_sample method will always return a result that is neither sampled nor recording.

METHODS

This class implements the OpenTelemetry::SDK::Trace::Sampler role. Please consult that module's documentation for details on the behaviours it provides.

new

$sampler = OpenTelemetry::SDK::Trace::Sampler::AlwaysOff->new;

Returns a new instance of this sampler. Takes no arguments.

description

$string = $sampler->description;

Returns the AlwaysOffSampler string.

should_sample

$result = $sampler->should_sample(
    context    => $context,
    trace_id   => $trace_id,
    kind       => $span_kind,
    name       => $span_name,
    attributes => \%attributes,
    links      => \@links,
);

Returns a OpenTelemetry::SDK::Trace::Sampler::Result that is neither sampled nor recording. The OpenTelemetry::Propagator::TraceContext::TraceState in the result will be read from the context provided in the context parameter, or from the current context if none is provided.

SEE ALSO

OpenTelemetry::SDK::Trace::Sampler
OpenTelemetry::SDK::Trace::Sampler::Result

COPYRIGHT AND LICENSE

This software is copyright (c) 2023 by José Joaquín Atria.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.