Number tracks a numberBucket over a bounded number of time buckets. Currently the buckets are one second long and only the last 10 seconds are kept.
NewNumber initializes a RollingNumber struct.
Increment increments the number in current timeBucket.
Max returns the maximum value seen in the last 10 seconds.
Sum sums the values over the buckets in the last 10 seconds.
UpdateMax updates the maximum value in the current bucket.
Timing maintains time Durations for each time bucket. The Durations are kept in an array to allow for a variety of statistics to be calculated from the source data.
NewTiming creates a RollingTiming struct.
Add appends the time.Duration given to the current time bucket.
Mean computes the average timing in the last 60 seconds.
Percentile computes the percentile given with a linear interpolation.
SortedDurations returns an array of time.Duration sorted from shortest to longest that have occurred in the last 60 seconds.