Class Samplers

java.lang.Object
io.opencensus.trace.samplers.Samplers

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

    • ALWAYS_SAMPLE

      private static final Sampler ALWAYS_SAMPLE
    • NEVER_SAMPLE

      private static final Sampler NEVER_SAMPLE
  • Constructor Details

    • Samplers

      private Samplers()
  • Method Details

    • 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:
      IllegalArgumentException - if probability is out of range
      Since:
      0.5