Documentation ¶
Overview ¶
Package aggregators contains aggregator factory methods. The aggregators package must not depend on any other scotty packages except for tsdb.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Avg = &Aggregator{ aggListCreater: func(size int) aggregatorListType { return make(averageListType, size) }, updaterCreater: kLinearInterpolation, } Count = &Aggregator{ aggListCreater: func(size int) aggregatorListType { return make(countListType, size) }, updaterCreater: kZero, } Max = &Aggregator{ aggListCreater: func(size int) aggregatorListType { return make(maxListType, size) }, updaterCreater: kLinearInterpolation, } Min = &Aggregator{ aggListCreater: func(size int) aggregatorListType { return make(minListType, size) }, updaterCreater: kLinearInterpolation, } Sum = &Aggregator{ aggListCreater: func(size int) aggregatorListType { return make(sumListType, size) }, updaterCreater: kLinearInterpolation, } )
Functions ¶
func New ¶
func New( start, end float64, aggregator *Aggregator, downSample float64, downSampleAggregator *Aggregator, fillPolicy FillPolicy, optionalRateSpec *RateSpec) tsdb.Aggregator
downSample is the down sample time in seconds. New treats downSample values less than 1.0 as 1.0
fillPolicy is the FillPolicy to use when downsampling.
optionalRateSpec is the TSDB rate specification. If non-nil, the Aggregate method reports rate of change per second in aggregated values instead of the actual aggregated values.
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
Aggregator instances correspond to OpenTSDB aggregators such as sum, avg, count, max, etc.
func ByName ¶
func ByName(aggregatorName string) (*Aggregator, bool)
ByName returns the aggregator with given name or nil, false if no aggregator matches given name
type FillPolicy ¶
type FillPolicy int
FillPolicy describes how to handle missing values after downsampling
const ( // None is the default. Do not emit missing values. None FillPolicy = iota // NaN behaves the same as None for now NaN // Null behaves the same as None for now Null // Zero means emit zero when no values are present in a downsample range Zero )
func ByFillPolicyName ¶
func ByFillPolicyName(fillPolicyName string) (FillPolicy, bool)
ByFillPolicyName returns the fill policy with given name or None, false if no fill policy matches given name
type RateSpec ¶
type RateSpec struct { // True if metric is a counter. Counter metrics are ever increasing. Counter bool // If Counter is true, the maximum value of the counter. // Used to correctly determine rate of change if counter rolls over CounterMax float64 // If Counter is true, the maximum expected rate of change. If rate // of change exceeds this, we assume counter rolled over because of // a restart. ResetValue float64 }
RateSpec is the rate of change specification for ever increasing metrics.