Package jenkins.metrics.util
Class ExponentialLeakyBucket<T>
- java.lang.Object
-
- jenkins.metrics.util.ExponentialLeakyBucket<T>
-
public class ExponentialLeakyBucket<T> extends Object
An exponentially-decaying random reservoir oflong
s. Uses Cormode et al's forward-decaying priority reservoir sampling method to produce a statistically representative sampling reservoir, exponentially biased towards newer entries.
-
-
Constructor Summary
Constructors Constructor Description ExponentialLeakyBucket()
Creates a newExponentialLeakyBucket
of 1028 elements, which offers a 99.9% confidence level with a 5% margin of error assuming a normal distribution, and an alpha factor of 0.015, which heavily biases the reservoir to the past 5 minutes of measurements.ExponentialLeakyBucket(int size, double alpha)
Creates a newExponentialLeakyBucket
.ExponentialLeakyBucket(int size, double alpha, com.codahale.metrics.Clock clock)
Creates a newExponentialLeakyBucket
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(T value)
void
add(T value, long timestamp)
Adds an old value with a fixed timestamp to the reservoir.int
size()
List<T>
values()
-
-
-
Constructor Detail
-
ExponentialLeakyBucket
public ExponentialLeakyBucket()
Creates a newExponentialLeakyBucket
of 1028 elements, which offers a 99.9% confidence level with a 5% margin of error assuming a normal distribution, and an alpha factor of 0.015, which heavily biases the reservoir to the past 5 minutes of measurements.
-
ExponentialLeakyBucket
public ExponentialLeakyBucket(int size, double alpha)
Creates a newExponentialLeakyBucket
.- Parameters:
size
- the number of samples to keep in the sampling reservoiralpha
- the exponential decay factor; the higher this is, the more biased the reservoir will be towards newer values
-
ExponentialLeakyBucket
public ExponentialLeakyBucket(int size, double alpha, com.codahale.metrics.Clock clock)
Creates a newExponentialLeakyBucket
.- Parameters:
size
- the number of samples to keep in the sampling reservoiralpha
- the exponential decay factor; the higher this is, the more biased the reservoir will be towards newer valuesclock
- the clock to use
-
-