Class SampleFilter

  • Direct Known Subclasses:
    AdaptiveSampleFilter

    public class SampleFilter
    extends Object
    Determines whether to sample or not, given a specified sample rate.
    • Field Detail

      • sampleRate

        protected double sampleRate
        The rate at which to sample requests.
    • Constructor Detail

      • SampleFilter

        public SampleFilter​(double sampleRate)
        Initialises the sample filter.
        Parameters:
        sampleRate - the rate, between 0 and 1, at which to sample requests.
      • SampleFilter

        public SampleFilter()
        Initialises the sample filter with a sample rate of 1. This means that every request will be sampled.
    • Method Detail

      • sample

        public boolean sample()
        Whether to sample or not.
        Returns:
        true if the request should be sampled, or false otherwise.