Package org.apache.storm.metric.internal
Class RateTracker
java.lang.Object
org.apache.storm.metric.internal.RateTracker
- All Implemented Interfaces:
- Closeable,- AutoCloseable
This class is a utility to track the rate of something.
- 
Constructor Details- 
RateTrackerpublic RateTracker(int validTimeWindowInMils, int numBuckets) Constructor.- Parameters:
- validTimeWindowInMils- events that happened before validTimeWindowInMils are not considered when reporting the rate.
- numBuckets- the number of time sildes to divide validTimeWindows. The more buckets, the smother the reported results will be.
 
 
- 
- 
Method Details- 
notifypublic void notify(long count) Notify the tracker upon new arrivals.- Parameters:
- count- number of arrivals
 
- 
reportRatepublic double reportRate()Get report rate.- Returns:
- the approximate average rate per second.
 
- 
closepublic void close()- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
 
-