Package io.dropwizard.metrics5
Class UniformReservoir
java.lang.Object
io.dropwizard.metrics5.UniformReservoir
- All Implemented Interfaces:
Reservoir
A random sampling reservoir of a stream of
long
s. Uses Vitter's Algorithm R to produce a
statistically representative sample.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newUniformReservoir
of 1028 elements, which offers a 99.9% confidence level with a 5% margin of error assuming a normal distribution.UniformReservoir
(int size) Creates a newUniformReservoir
. -
Method Summary
-
Constructor Details
-
UniformReservoir
public UniformReservoir()Creates a newUniformReservoir
of 1028 elements, which offers a 99.9% confidence level with a 5% margin of error assuming a normal distribution. -
UniformReservoir
public UniformReservoir(int size) Creates a newUniformReservoir
.- Parameters:
size
- the number of samples to keep in the sampling reservoir
-
-
Method Details
-
size
public int size()Description copied from interface:Reservoir
Returns the number of values recorded. -
update
public void update(long value) Description copied from interface:Reservoir
Adds a new recorded value to the reservoir. -
getSnapshot
Description copied from interface:Reservoir
Returns a snapshot of the reservoir's values.- Specified by:
getSnapshot
in interfaceReservoir
- Returns:
- a snapshot of the reservoir's values
-