Package ai.vespa.sampling
Class MaxSamplesPerPeriod
java.lang.Object
ai.vespa.sampling.MaxSamplesPerPeriod
- All Implemented Interfaces:
SamplingStrategy
Very basic sampling strategy which allows for sampling N requests within a fixed
time window. No attempt is made to distribute the samples evenly within the time
period; this is on a first-come, first-serve basis.
-
Constructor Summary
ConstructorsConstructorDescriptionMaxSamplesPerPeriod(MonotonicNanoClock nanoClock, long periodLengthInNanos, long maxSamplesPerPeriod) -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic MaxSamplesPerPeriodwithSteadyClock(long periodLengthInNanos, long maxSamplesPerPeriod)
-
Constructor Details
-
MaxSamplesPerPeriod
public MaxSamplesPerPeriod(MonotonicNanoClock nanoClock, long periodLengthInNanos, long maxSamplesPerPeriod)
-
-
Method Details
-
withSteadyClock
public static MaxSamplesPerPeriod withSteadyClock(long periodLengthInNanos, long maxSamplesPerPeriod) -
shouldSample
public boolean shouldSample()- Specified by:
shouldSamplein interfaceSamplingStrategy
-