Documentation
¶
Index ¶
- type Aggregate
- type Aggregator
- type Feeder
- type Iterator
- type Namer
- type Rollup
- func NewAverageRollup(iterator Iterator, name string) Rollup
- func NewCountRollup(iterator Iterator, name string) Rollup
- func NewLimitedRollup(limit int, iterator Iterator, rollup Rollup) Rollup
- func NewMaxRollup(iterator Iterator, name string) Rollup
- func NewMinRollup(iterator Iterator, name string) Rollup
- func NewPercentageRollup(aggregator Aggregator, lower float64, upper float64, name string) Rollup
- func NewPercentileRollup(percentile float64, iterator Iterator, preallocHint int, name string) Rollup
- func NewSumRollup(iterator Iterator, name string) Rollup
- type Window
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator interface {
Aggregate() *Aggregate
}
Aggregator is responsible for compacting a window of time into a single value for evaluation.
type Feeder ¶
type Feeder interface {
Feed(value float64)
}
Feeder populates a rolling window of data with input.
type Iterator ¶
type Iterator interface {
Iterate(func(float64))
}
Iterator takes a function and calls it for every point in a window.
type Rollup ¶
type Rollup interface { Aggregator Namer }
Rollup is an annotated Aggregator of data.
func NewAverageRollup ¶
NewAverageRollup returns an Aggregator that computes the average of all values in a window.
func NewCountRollup ¶
NewCountRollup returns an Aggregator that computes the total number of elements in a window.
func NewLimitedRollup ¶
NewLimitedRollup creates an Aggregator that returns zero until the given iterator contains more than `limit` values are contained. Once the limit is passed, the given Aggregator is called to produce the output.
func NewMaxRollup ¶
NewMaxRollup returns an Aggregator that computes the max of all values in a window.
func NewMinRollup ¶
NewMinRollup returns an Aggregator that computes the min of all values in a window.
func NewPercentageRollup ¶
func NewPercentageRollup(aggregator Aggregator, lower float64, upper float64, name string) Rollup
NewPercentageRollup creates an Aggregator that returns the percent between lower and upper of the aggregate value. If the aggregate is less than the lower then the result is 0.
func NewPercentileRollup ¶
func NewPercentileRollup(percentile float64, iterator Iterator, preallocHint int, name string) Rollup
NewPercentileRollup returns an Aggregator that computes the given percentile of the values in a window. The given percentile is evaluated as N percentile such that the value 10.0 is considered to be 10.0 percentile. Non-whole numbers maybe be given to calculate, for example, the 99.9 percentile. If the given percentile can be resolved exactly with the given data then the exact value is returned. If it cannot be resolved exactly, such as cases where there are not enough data to, then the result will be based on linear interpolation of the two closest points.
func NewSumRollup ¶
NewSumRollup returns an Aggregator that computes the sum of all values in a window.
type Window ¶
Window is a composit of Iterator and Feeder types.
func NewPointWindow ¶
NewPointWindow generates a RollingWindow that operates on a rolling set of input points. The given window size determines the total number of data points that are maintained within the window.
func NewTimeWindow ¶
NewTimeWindow generates a RollingWindow that operates on a rolling time duration. The given duration will be used to bucket data into segments within the window. If data points are received entire windows aparts then the window will only contain a single data point. If one or more durations of the window are missed then they are zeroed out to keep the window consistent.