Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket groups together objects with the same Index it keeps track of statistical quantities relating to the collection by using the stats
func (*Bucket) Push ¶
Push adds an element to the bucket for the given index. it returns true if the bucket has the right index, false otherwise. This allows to build higher level abstractions i.e. window etc ...
func (Bucket) Values ¶
func (b Bucket) Values() StatsCollector
Stats returns the current Stats for the bucket.
type BucketRing ¶
type BucketRing struct {
// contains filtered or unexported fields
}
BucketRing acts like a ring buffer keeping the last x elements
func NewBucketRing ¶
func NewBucketRing(size int) *BucketRing
NewBucketRing creates a new ring with the given buffer size.
func (*BucketRing) Get ¶
func (r *BucketRing) Get(transform Transform) []interface{}
Get returns an ordered slice of the ring elements
func (*BucketRing) Size ¶
func (r *BucketRing) Size() int
Size returns the number of non-nil elements within the ring.
type HistoryWindow ¶
type HistoryWindow struct {
// contains filtered or unexported fields
}
HistoryWindow keeps the last x buckets based on the window interval given
func NewHistoryWindow ¶
func NewHistoryWindow(duration time.Duration, size int) *HistoryWindow
NewHistoryWindow creates a new history window.
func (*HistoryWindow) Get ¶
func (h *HistoryWindow) Get(transform Transform) []interface{}
Get returns the transformed bucket value at the corresponding index.
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring acts like a ring buffer keeping the last x elements
type SizeWindow ¶
type SizeWindow struct {
// contains filtered or unexported fields
}
SizeWindow is a window indexed by the current time.
func NewSizeWindow ¶
func NewSizeWindow(size int) *SizeWindow
NewSizeWindow creates a new SizeWindow with the given duration.
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
Stats is a set of statistical properties of a set of numbers.
func (Stats) SampleStDev ¶
SampleStDev is the sample standard deviation of the set.
func (Stats) SampleVariance ¶
SampleVariance is the sample variance of the set.
type StatsCollector ¶
type StatsCollector struct {
// contains filtered or unexported fields
}
StatsCollector is a collection of Stats variables. This enabled multi-dimensional tracking.
func NewStatsCollector ¶
func NewStatsCollector(dim int) *StatsCollector
NewStatsCollector creates a new Stats collector.
func (*StatsCollector) Push ¶
func (sc *StatsCollector) Push(v ...float64)
Push pushes each value to the corresponding dimension.
func (*StatsCollector) Size ¶
func (sc *StatsCollector) Size() int
Push pushes each value to the corresponding dimension.
func (StatsCollector) Stats ¶
func (sc StatsCollector) Stats() []*Stats
type TimeWindow ¶
type TimeWindow struct {
// contains filtered or unexported fields
}
TimeWindow is a window indexed by the current time.
func NewTimeWindow ¶
func NewTimeWindow(duration time.Duration) *TimeWindow
NewTimeWindow creates a new TimeWindow with the given duration.
type Transform ¶
type Transform func(bucket *Bucket) interface{}
Transform is a operation acting on a bucket and returning a float. It is used to get the relevant bucket metric, without the need to make repeated iterations.
type VectorRing ¶
type VectorRing struct {
// contains filtered or unexported fields
}
VectorRing is a temporary cache of vectors it re-uses a slice of vectors (matrix) and keeps track of the starting index. In that sense it s effectively a ring. A major differentiating factor is the (+1) logic, where the last element is handled separately.
func NewSplitVectorRing ¶
func NewSplitVectorRing(n int) *VectorRing
func NewVectorRing ¶
func NewVectorRing(n int) *VectorRing
func (VectorRing) Copy ¶
func (w VectorRing) Copy() VectorRing
func (VectorRing) Size ¶
func (w VectorRing) Size() int
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window is a helper struct allowing to retrieve buckets of Stats from a streaming data set. the bucket indexing is based on the time.
func NewWindow ¶
NewWindow creates a new window of the given window size e.g. the index range for each bucket.