Class ProbabilisticSampleRate
- java.lang.Object
-
- com.yahoo.vespa.streamingvisitors.tracing.ProbabilisticSampleRate
-
- All Implemented Interfaces:
SamplingStrategy
public class ProbabilisticSampleRate extends java.lang.Object implements SamplingStrategy
Simple implementation of OpenCensus algorithm for probabilistic rate limiting as outlined in https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/Sampling.md
-
-
Constructor Summary
Constructors Constructor Description ProbabilisticSampleRate(MonotonicNanoClock nanoClock, java.util.function.Supplier<java.util.Random> randomSupplier, double desiredSamplesPerSec)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
shouldSample()
static ProbabilisticSampleRate
withSystemDefaults(double desiredSamplesPerSec)
-
-
-
Constructor Detail
-
ProbabilisticSampleRate
public ProbabilisticSampleRate(MonotonicNanoClock nanoClock, java.util.function.Supplier<java.util.Random> randomSupplier, double desiredSamplesPerSec)
-
-
Method Detail
-
withSystemDefaults
public static ProbabilisticSampleRate withSystemDefaults(double desiredSamplesPerSec)
-
shouldSample
public boolean shouldSample()
- Specified by:
shouldSample
in interfaceSamplingStrategy
-
-