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 newSlidingTimeWindowArrayReservoirwith the given window of time.SlidingTimeWindowArrayReservoir(long window, TimeUnit windowUnit, Clock clock) Creates a newSlidingTimeWindowArrayReservoirwith the given clock and window of time. -
Method Summary
-
Constructor Details
-
SlidingTimeWindowArrayReservoir
Creates a newSlidingTimeWindowArrayReservoirwith the given window of time.- Parameters:
window- the window of timewindowUnit- the unit ofwindow
-
SlidingTimeWindowArrayReservoir
Creates a newSlidingTimeWindowArrayReservoirwith the given clock and window of time.- Parameters:
window- the window of timewindowUnit- the unit ofwindowclock- theClockto use
-
-
Method Details
-
size
public int size()Description copied from interface:ReservoirReturns the number of values recorded. -
update
public void update(long value) Description copied from interface:ReservoirAdds a new recorded value to the reservoir. -
getSnapshot
Description copied from interface:ReservoirReturns a snapshot of the reservoir's values.- Specified by:
getSnapshotin interfaceReservoir- Returns:
- a snapshot of the reservoir's values
-