aggregator

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: BSD-2-Clause-Views Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetProcessorConstructor added in v0.9.3

func GetProcessorConstructor(fun string) (func(val float64, ts uint32) Processor, error)

func InitMetrics added in v0.11.0

func InitMetrics()

Types

type Aggregator

type Aggregator struct {
	Fun string `json:"fun"`

	Regex  string `json:"regex,omitempty"`
	Prefix string `json:"prefix,omitempty"`
	Sub    string `json:"substring,omitempty"`

	OutFmt string

	Cache bool

	Interval uint // expected interval between values in seconds, we will quantize to make sure alginment to interval-spaced timestamps
	Wait     uint // seconds to wait after quantized time value before flushing final outcome and ignoring future values that are sent too late.
	DropRaw  bool // drop raw values "consumed" by this aggregator

	Key string
	// contains filtered or unexported fields
}

func New

func New(fun, regex, prefix, sub, outFmt string, cache bool, interval, wait uint, dropRaw bool, out chan []byte) (*Aggregator, error)

New creates an aggregator

func NewMocked added in v0.9.3

func NewMocked(fun, regex, prefix, sub, outFmt string, cache bool, interval, wait uint, dropRaw bool, out chan []byte, inBuf int, now func() time.Time, tick <-chan time.Time) (*Aggregator, error)

func (*Aggregator) AddMaybe added in v0.9.3

func (a *Aggregator) AddMaybe(buf [][]byte, val float64, ts uint32) bool

func (*Aggregator) AddOrCreate

func (a *Aggregator) AddOrCreate(key string, ts uint32, quantized uint, value float64)

func (*Aggregator) Flush

func (a *Aggregator) Flush(cutoff uint)

Flush finalizes and removes aggregations that are due

func (*Aggregator) PreMatch

func (a *Aggregator) PreMatch(buf []byte) bool

PreMatch checks if the specified metric matches the specified prefix and/or substring If prefix isn't explicitly specified it will be derived from the regex where possible. If this returns false the metric will not be passed through to the main regex matching stage.

func (*Aggregator) Shutdown

func (a *Aggregator) Shutdown()

func (*Aggregator) Snapshot

func (a *Aggregator) Snapshot() *Aggregator

to view the state of the aggregator at any point in time

type Avg

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

Avg aggregates to average

func (*Avg) Add added in v0.9.3

func (a *Avg) Add(val float64, ts uint32)

func (*Avg) Flush added in v0.9.3

func (a *Avg) Flush() ([]processorResult, bool)

type CacheEntry added in v0.9.3

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

type Count added in v0.12.0

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

Count aggregates to the number of values seen

func (*Count) Add added in v0.12.0

func (c *Count) Add(val float64, ts uint32)

func (*Count) Flush added in v0.12.0

func (c *Count) Flush() ([]processorResult, bool)

type Delta added in v0.9.0

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

Delta aggregates to the difference between highest and lowest value seen

func (*Delta) Add added in v0.9.3

func (d *Delta) Add(val float64, ts uint32)

func (*Delta) Flush added in v0.9.3

func (d *Delta) Flush() ([]processorResult, bool)

type Derive added in v0.9.3

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

Derive aggregates to the derivative of the largest timeframe we get

func (*Derive) Add added in v0.9.3

func (d *Derive) Add(val float64, ts uint32)

func (*Derive) Flush added in v0.9.3

func (d *Derive) Flush() ([]processorResult, bool)

type Last added in v0.9.0

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

Last aggregates to the last value seen

func (*Last) Add added in v0.9.3

func (l *Last) Add(val float64, ts uint32)

func (*Last) Flush added in v0.9.3

func (l *Last) Flush() ([]processorResult, bool)

type Max

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

Max aggregates to the highest value seen

func (*Max) Add added in v0.9.3

func (m *Max) Add(val float64, ts uint32)

func (*Max) Flush added in v0.9.3

func (m *Max) Flush() ([]processorResult, bool)

type Min

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

Min aggregates to the lowest value seen

func (*Min) Add added in v0.9.3

func (m *Min) Add(val float64, ts uint32)

func (*Min) Flush added in v0.9.3

func (m *Min) Flush() ([]processorResult, bool)

type Percentiles added in v0.11.0

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

Percentiles aggregates to different percentiles

func (*Percentiles) Add added in v0.11.0

func (p *Percentiles) Add(val float64, ts uint32)

func (*Percentiles) Flush added in v0.11.0

func (p *Percentiles) Flush() ([]processorResult, bool)

Using the latest recommendation from NIST See https://www.itl.nist.gov/div898/handbook/prc/section2/prc262.htm The method implemented corresponds to method R6 of Hyndman and Fan. See https://en.wikipedia.org/wiki/Percentile, Third variant

type Processor added in v0.9.3

type Processor interface {
	// Add adds a point to aggregate
	Add(val float64, ts uint32)
	// Flush returns the aggregated value(s) and true if it is valid
	// the only reason why it would be non-valid is for aggregators that need
	// more than 1 value but they didn't have enough to produce a useful result.
	Flush() ([]processorResult, bool)
}

func NewAvg added in v0.9.3

func NewAvg(val float64, ts uint32) Processor

func NewCount added in v0.12.0

func NewCount(val float64, ts uint32) Processor

func NewDelta added in v0.9.3

func NewDelta(val float64, ts uint32) Processor

func NewDerive added in v0.9.3

func NewDerive(val float64, ts uint32) Processor

func NewLast added in v0.9.3

func NewLast(val float64, ts uint32) Processor

func NewMax added in v0.9.3

func NewMax(val float64, ts uint32) Processor

func NewMin added in v0.9.3

func NewMin(val float64, ts uint32) Processor

func NewPercentiles added in v0.11.0

func NewPercentiles(val float64, ts uint32) Processor

func NewStdev added in v0.9.3

func NewStdev(val float64, ts uint32) Processor

func NewSum added in v0.9.3

func NewSum(val float64, ts uint32) Processor

type RangeTracker added in v0.11.0

type RangeTracker struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewRangeTracker added in v0.11.0

func NewRangeTracker() *RangeTracker

func (*RangeTracker) Run added in v0.11.0

func (m *RangeTracker) Run()

func (*RangeTracker) Sample added in v0.11.0

func (m *RangeTracker) Sample(ts uint32)

type Stdev added in v0.9.0

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

Stdev aggregates to standard deviation

func (*Stdev) Add added in v0.9.3

func (s *Stdev) Add(val float64, ts uint32)

func (*Stdev) Flush added in v0.9.3

func (s *Stdev) Flush() ([]processorResult, bool)

type Sum

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

Sum aggregates to sum

func (*Sum) Add added in v0.9.3

func (s *Sum) Add(val float64, ts uint32)

func (*Sum) Flush added in v0.9.3

func (s *Sum) Flush() ([]processorResult, bool)

type TsSlice added in v0.12.0

type TsSlice []uint

func (TsSlice) Len added in v0.12.0

func (p TsSlice) Len() int

func (TsSlice) Less added in v0.12.0

func (p TsSlice) Less(i, j int) bool

func (TsSlice) Swap added in v0.12.0

func (p TsSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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