Documentation ¶
Overview ¶
Package statstracker keeps track of simple stats in the Agent.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker Keeps track of simple stats over its lifetime and a configurable time range. Tracker is designed to be memory efficient by aggregating data into buckets. For example a time frame of 24 hours with a bucketFrame of 1 hour will ensure that only 24 points are ever kept in memory. New data is considered in the stats immediately while old data is removed by dropping expired aggregated buckets.
func NewTracker ¶
NewTracker Creates a new Tracker instance
func NewTrackerWithTimeProvider ¶
func NewTrackerWithTimeProvider(timeFrame time.Duration, bucketSize time.Duration, timeProvider timeProvider) *Tracker
NewTrackerWithTimeProvider Creates a new Tracker instance with a time provider closure (mostly for testing)
func (*Tracker) AllTimeAvg ¶
AllTimeAvg Gets the all time average of values seen so far
func (*Tracker) AllTimePeak ¶
AllTimePeak Gets the largest value seen so far
func (*Tracker) MovingPeak ¶
MovingPeak Gets the largest value seen within the time frame