aggregation

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accumulator

type Accumulator func(time time.Time, bucket float64Bucket)

Accumulator is a function accumulating buckets and their time..

func YoungerThan

func YoungerThan(oldest time.Time, acc Accumulator) Accumulator

YoungerThan only applies the accumulator to buckets that are younger than the given time.

type Average

type Average struct {
	// contains filtered or unexported fields
}

Average is used to keep the values necessary to compute an average.

func (*Average) Accumulate

func (a *Average) Accumulate(_ time.Time, bucket float64Bucket)

Accumulate accumulates the values needed to compute an average.

func (*Average) Value

func (a *Average) Value() float64

Value returns the average or 0 if no buckets have been accumulated.

type TimedFloat64Buckets

type TimedFloat64Buckets struct {
	// contains filtered or unexported fields
}

TimedFloat64Buckets keeps buckets that have been collected at a certain time.

func NewTimedFloat64Buckets

func NewTimedFloat64Buckets(granularity time.Duration) *TimedFloat64Buckets

NewTimedFloat64Buckets generates a new TimedFloat64Buckets with the given granularity.

func (*TimedFloat64Buckets) ForEachBucket

func (t *TimedFloat64Buckets) ForEachBucket(accs ...Accumulator)

ForEachBucket calls the given Accumulator function for each bucket.

func (*TimedFloat64Buckets) IsEmpty

func (t *TimedFloat64Buckets) IsEmpty() bool

IsEmpty returns whether or not there are no values currently stored.

func (*TimedFloat64Buckets) Record

func (t *TimedFloat64Buckets) Record(time time.Time, name string, value float64)

Record adds a value with an associated time to the correct bucket.

func (*TimedFloat64Buckets) RemoveOlderThan

func (t *TimedFloat64Buckets) RemoveOlderThan(time time.Time)

RemoveOlderThan removes buckets older than the given time from the state.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL