Class Samplers


  • public final class Samplers
    extends java.lang.Object
    Static class to access a set of pre-defined Samplers.
    Since:
    0.5
    • Field Detail

      • ALWAYS_SAMPLE

        private static final Sampler ALWAYS_SAMPLE
      • NEVER_SAMPLE

        private static final Sampler NEVER_SAMPLE
    • Constructor Detail

      • Samplers

        private Samplers()
    • Method Detail

      • alwaysSample

        public static Sampler alwaysSample()
        Returns a Sampler that always makes a "yes" decision on Span sampling.
        Returns:
        a Sampler that always makes a "yes" decision on Span sampling.
        Since:
        0.5
      • neverSample

        public static Sampler neverSample()
        Returns a Sampler that always makes a "no" decision on Span sampling.
        Returns:
        a Sampler that always makes a "no" decision on Span sampling.
        Since:
        0.5
      • probabilitySampler

        public static Sampler probabilitySampler​(double probability)
        Returns a Sampler that makes a "yes" decision with a given probability.
        Parameters:
        probability - The desired probability of sampling. Must be within [0.0, 1.0].
        Returns:
        a Sampler that makes a "yes" decision with a given probability.
        Throws:
        java.lang.IllegalArgumentException - if probability is out of range
        Since:
        0.5