Package io.dropwizard.metrics5
Class EWMA
java.lang.Object
io.dropwizard.metrics5.EWMA
An exponentially-weighted moving average.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EWMACreates a new EWMA which is equivalent to the UNIX fifteen minute load average and which expects to be ticked every 5 seconds.static EWMACreates a new EWMA which is equivalent to the UNIX five minute load average and which expects to be ticked every 5 seconds.doubleReturns the rate in the given units of time.static EWMACreates a new EWMA which is equivalent to the UNIX one minute load average and which expects to be ticked every 5 seconds.voidreset()Set the rate to the smallest possible positive value.voidtick()Mark the passage of time and decay the current rate accordingly.voidupdate(long n) Update the moving average with a new value.
-
Constructor Details
-
EWMA
Create a new EWMA with a specific smoothing constant.- Parameters:
alpha- the smoothing constantinterval- the expected tick intervalintervalUnit- the time unit of the tick interval
-
-
Method Details
-
oneMinuteEWMA
Creates a new EWMA which is equivalent to the UNIX one minute load average and which expects to be ticked every 5 seconds.- Returns:
- a one-minute EWMA
-
fiveMinuteEWMA
Creates a new EWMA which is equivalent to the UNIX five minute load average and which expects to be ticked every 5 seconds.- Returns:
- a five-minute EWMA
-
fifteenMinuteEWMA
Creates a new EWMA which is equivalent to the UNIX fifteen minute load average and which expects to be ticked every 5 seconds.- Returns:
- a fifteen-minute EWMA
-
update
public void update(long n) Update the moving average with a new value.- Parameters:
n- the new value
-
reset
public void reset()Set the rate to the smallest possible positive value. Used to avoid calling tick a large number of times. -
tick
public void tick()Mark the passage of time and decay the current rate accordingly. -
getRate
Returns the rate in the given units of time.- Parameters:
rateUnit- the unit of time- Returns:
- the rate
-