org.springframework.integration.monitor
Class ExponentialMovingAverageRatio
java.lang.Object
org.springframework.integration.monitor.ExponentialMovingAverageRatio
public class ExponentialMovingAverageRatio
- extends java.lang.Object
Cumulative statistics for success ratio with higher weight given to recent data but without storing any history.
Clients call success()
or failure()
when an event occurs, and the ratio of success to total events
is accumulated. Older values are given exponentially smaller weight, with a decay factor determined by a duration
chosen by the client. The rate measurement weights decay in two dimensions:
- in time according to the lapse period supplied:
weight = exp((t0-t)/T)
where t0
is the
last measurement time, t
is the current time and T
is the lapse period)
- per measurement according to the lapse window supplied:
weight = exp(-i/L)
where L
is
the lapse window and i
is the sequence number of the measurement.
- Since:
- 2.0
- Author:
- Dave Syer
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ExponentialMovingAverageRatio
public ExponentialMovingAverageRatio(double lapsePeriod,
int window)
- Parameters:
lapsePeriod
- the exponential lapse rate for the rate average (in seconds)window
- the exponential lapse window (number of measurements)
success
public void success()
- Add a new event with successful outcome.
failure
public void failure()
- Add a new event with failed outcome.
reset
public void reset()
getCount
public int getCount()
- Returns:
- the number of measurements recorded
getTimeSinceLastMeasurement
public double getTimeSinceLastMeasurement()
- Returns:
- the time in seconds since the last measurement
getMean
public double getMean()
- Returns:
- the mean success rate
getStandardDeviation
public double getStandardDeviation()
- Returns:
- the approximate standard deviation of the success rate measurements
getMax
public double getMax()
- Returns:
- the maximum value recorded of the exponential weighted average (per measurement) success rate
getMin
public double getMin()
- Returns:
- the minimum value recorded of the exponential weighted average (per measurement) success rate
getStatistics
public Statistics getStatistics()
- Returns:
- summary statistics (count, mean, standard deviation etc.)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object