io.opentelemetry.sdk.trace.samplers.package-info Maven / Gradle / Ivy
Show all versions of opentelemetry-sdk-trace Show documentation
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
/**
* This package contains {@link io.opentelemetry.sdk.trace.samplers.Sampler}s for selecting traces
* that are recorded and exported.
*
* Sampling is a mechanism to control the noise and overhead introduced by OpenTelemetry by
* reducing the number of samples of traces collected and sent to the backend. See the OpenTelemetry
* specification for more details.
*
*
The following sampling strategies are provided here:
*
*
{@link io.opentelemetry.sdk.trace.samplers.Sampler#alwaysOff()} : This strategy will ensure
* that no Spans are ever sent to the export pipeline.
*
*
{@link io.opentelemetry.sdk.trace.samplers.Sampler#alwaysOn()} : This strategy will ensure
* that every Span will be sent to the export pipeline.
*
*
{@link io.opentelemetry.sdk.trace.samplers.Sampler#traceIdRatioBased(double)} : This strategy
* will sample the provided fraction of Spans, deterministically based on the TraceId of the Spans.
* This means that all spans from the a given trace will have the same sampling result.
*
*
{@link
* io.opentelemetry.sdk.trace.samplers.Sampler#parentBased(io.opentelemetry.sdk.trace.samplers.Sampler)}
* : This strategy will always use the sampled state of the parent span when deciding whether to
* sample a Span or not. If the the Span has no parent, the provided "root" Sampler will be used for
* that decision. The parent-based strategy is highly configurable, using the {@link
* io.opentelemetry.sdk.trace.samplers.ParentBasedSamplerBuilder} which can be acquired from the
* {@link
* io.opentelemetry.sdk.trace.samplers.Sampler#parentBasedBuilder(io.opentelemetry.sdk.trace.samplers.Sampler)}
* method.
*/
@ParametersAreNonnullByDefault
package io.opentelemetry.sdk.trace.samplers;
import javax.annotation.ParametersAreNonnullByDefault;