Package io.dropwizard.metrics5
Class SlidingTimeWindowArrayReservoir
java.lang.Object
io.dropwizard.metrics5.SlidingTimeWindowArrayReservoir
- All Implemented Interfaces:
Reservoir
A
Reservoir
implementation backed by a sliding window that stores only the measurements made
in the last N
seconds (or other time unit).-
Constructor Summary
ConstructorsConstructorDescriptionSlidingTimeWindowArrayReservoir
(long window, TimeUnit windowUnit) Creates a newSlidingTimeWindowArrayReservoir
with the given window of time.SlidingTimeWindowArrayReservoir
(long window, TimeUnit windowUnit, Clock clock) Creates a newSlidingTimeWindowArrayReservoir
with the given clock and window of time. -
Method Summary
-
Constructor Details
-
SlidingTimeWindowArrayReservoir
Creates a newSlidingTimeWindowArrayReservoir
with the given window of time.- Parameters:
window
- the window of timewindowUnit
- the unit ofwindow
-
SlidingTimeWindowArrayReservoir
Creates a newSlidingTimeWindowArrayReservoir
with the given clock and window of time.- Parameters:
window
- the window of timewindowUnit
- the unit ofwindow
clock
- theClock
to use
-
-
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
-