Spring Integration

org.springframework.integration.monitor
Class ExponentialMovingAverageRatio

java.lang.Object
  extended by 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:

Since:
2.0
Author:
Dave Syer

Constructor Summary
ExponentialMovingAverageRatio(double lapsePeriod, int window)
           
 
Method Summary
 void failure()
          Add a new event with failed outcome.
 int getCount()
           
 double getMax()
           
 double getMean()
           
 double getMin()
           
 double getStandardDeviation()
           
 Statistics getStatistics()
           
 double getTimeSinceLastMeasurement()
           
 void reset()
           
 void success()
          Add a new event with successful outcome.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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)
Method Detail

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

Spring Integration