The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

OpenTelemetry::SDK::Trace::Sampler::Result - The result of a sampling decision

SYNOPSIS

    ...

DESCRIPTION

This object represents the result of a sampling decision made by a sampler created via OpenTelemetry::SDK::Trace::Sampler. It encapsulates the actual decision, as well as additional information the sampler wants to pass down to the caller, including a OpenTelemetry::Propagation::TraceContext::TraceState and a set of attributes.

Users are unlikely to have to create an instance of this class. Most commonly, it will be used as the return value of a sampler's should_sample|OpenTelemetry::SDK::Trace::Sampler/should_sample method. See that documentation for details.

METHODS

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

new

    $result = OpenTelemetry::SDK::Trace::Sampler::Result->new(
        trace_state => $trace_state,
        decision    => $decision,
    );

Constructs a new result instance. It takes a mandatory OpenTelemetry::Propagation::TraceContext::TraceState object, and a value representing the decision. The decision is one of the values described in the CONSTANTS section below.

sampled

    $bool = $result->sampled;

Returns true if this result indicates a span that should be sampled, or false otherwise.

recording

    $bool = $result->recording;

Returns true if this result indicates a span that is recording, or false otherwise.

trace_state

    $trace_state = $result->trace_state;

Returns the OpenTelemetry::Propagation::TraceContext::TraceState object associated to this sampling result.

CONSTANTS

These represent the sampling decisions in this result.

DROP

Do not record events or sample.

RECORD_ONLY

Record events but don't sample.

RECORD_AND_SAMPLE

Record events and sample.

SEE ALSO

OpenTelemetry::Attributes
OpenTelemetry::SDK::Trace::Sampler
OpenTelemetry::Propagation::TraceContext::TraceState
The specification for a sampler's should_sample method

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.