Package jenkins.metrics.util
Class ExponentialLeakyBucket<T>
java.lang.Object
jenkins.metrics.util.ExponentialLeakyBucket<T>
An exponentially-decaying random reservoir of
long
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
ConstructorsConstructorDescriptionCreates 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
-
Constructor Details
-
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
-
-
Method Details
-
size
public int size() -
add
-
add
Adds an old value with a fixed timestamp to the reservoir.- Parameters:
value
- the value to be addedtimestamp
- the epoch timestamp ofvalue
in seconds
-
values
-