Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FastPercentile ¶
FastPercentile implements the pSquare percentile estimation algorithm for calculating percentiles from streams of data using fixed memory allocations.
func Percentile ¶
Percentile returns an aggregating function that computes the given percentile calculation for a window.
Types ¶
type PointPolicy ¶
type PointPolicy struct {
// contains filtered or unexported fields
}
PointPolicy is a rolling window policy that tracks the last N values inserted regardless of insertion time.
func NewPointPolicy ¶
func NewPointPolicy(window Window) *PointPolicy
NewPointPolicy generates a Policy that operates on a rolling set of input points. The number of points is determined by the size of the given window. Each bucket will contain, at most, one data point when the window is full.
func (*PointPolicy) Append ¶
func (w *PointPolicy) Append(value float64)
Append a value to the window.
type TimePolicy ¶
type TimePolicy struct {
// contains filtered or unexported fields
}
TimePolicy is a window Accumulator implementation that uses some duration of time to determine the content of the window.
func NewTimePolicy ¶
func NewTimePolicy(window Window, bucketDuration time.Duration) *TimePolicy
NewTimePolicy manages a window with rolling time duratinos. The given duration will be used to bucket data 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.
func (*TimePolicy) Append ¶
func (w *TimePolicy) Append(value float64)
Append a value to the window using a time bucketing strategy.
func (*TimePolicy) AppendWithTimestamp ¶
func (w *TimePolicy) AppendWithTimestamp(value float64, timestamp time.Time)
AppendWithTimestamp same as Append but with timestamp as parameter
type Window ¶
type Window [][]float64
Window represents a bucketed set of data. It should be used in conjunction with a Policy to populate it with data using some windowing policy.
func NewPreallocatedWindow ¶
NewPreallocatedWindow creates a Window both with the given number of buckets and with a preallocated bucket size. This constructor may be used when the number of data points per-bucket can be estimated and/or when the desire is to allocate a large slice so that allocations do not happen as the Window is populated by a Policy.