Class ProbabilisticSampler

java.lang.Object
org.opensearch.telemetry.tracing.sampler.ProbabilisticSampler
All Implemented Interfaces:
io.opentelemetry.sdk.trace.samplers.Sampler

public class ProbabilisticSampler extends Object implements io.opentelemetry.sdk.trace.samplers.Sampler
ProbabilisticSampler implements a probability sampling strategy based on configured sampling ratio.
  • Method Details

    • create

      public static io.opentelemetry.sdk.trace.samplers.Sampler create(TelemetrySettings telemetrySettings, Settings settings, io.opentelemetry.sdk.trace.samplers.Sampler fallbackSampler)
      Create probabilistic sampler.
      Parameters:
      telemetrySettings - the telemetry settings
      settings - the settings
      fallbackSampler - the fallback sampler
      Returns:
      the probabilistic sampler
    • shouldSample

      public io.opentelemetry.sdk.trace.samplers.SamplingResult shouldSample(io.opentelemetry.context.Context parentContext, String traceId, String name, io.opentelemetry.api.trace.SpanKind spanKind, io.opentelemetry.api.common.Attributes attributes, List<io.opentelemetry.sdk.trace.data.LinkData> parentLinks)
      Specified by:
      shouldSample in interface io.opentelemetry.sdk.trace.samplers.Sampler
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface io.opentelemetry.sdk.trace.samplers.Sampler
    • toString

      public String toString()
      Overrides:
      toString in class Object