metrictank: github.com/grafana/metrictank/consolidation Index | Files

package consolidation

import "github.com/grafana/metrictank/consolidation"

Package consolidation provides an abstraction for consolidators

Index

Package Files

consolidate.go consolidation.go consolidation_gen.go

func AggEvery Uses

func AggEvery(numPoints, maxPoints uint32) uint32

returns how many points should be aggregated together so that you end up with as many points as possible, but never more than maxPoints

func Consolidate Uses

func Consolidate(in []schema.Point, aggNum uint32, consolidator Consolidator) []schema.Point

Consolidate consolidates `in`, aggNum points at a time via the given function note: the returned slice repurposes in's backing array. it will always aggregate aggNum-sized groups of points together, with the timestamp of the last of them, and it always starts at the beginning, possibly having a point at the end that didn't incorporate as much data

func ConsolidateContext Uses

func ConsolidateContext(ctx context.Context, in []schema.Point, aggNum uint32, consolidator Consolidator) []schema.Point

ConsolidateContext wraps a Consolidate() call with a context.Context condition

func ConsolidateNudged Uses

func ConsolidateNudged(points []schema.Point, interval, maxDataPoints uint32, consolidator Consolidator) ([]schema.Point, uint32)

ConsolidateNudged consolidates points in a "mostly-stable" way, meaning if you run the same function again so that the input receives new points at the end and old points get removed at the beginning, we keep picking the same points to consolidate together, except for cases where there's a few points and a low MaxDataPoints. See nudgeMaybe() interval is the interval between the input points

func GetAggFunc Uses

func GetAggFunc(consolidator Consolidator) batch.AggFunc

GetAggFunc returns a batch aggregation function or any valid consolidator, or nil otherwise

func Validate Uses

func Validate(fn string) error

type Consolidator Uses

type Consolidator int

consolidator is a highlevel description of a point consolidation method mostly for use by the http api, but can also be used internally for data processing go:generate msgp

const (
    None Consolidator = iota
    Avg
    Sum
    Lst
    Max
    Min
    Cnt // not available through http api
    Mult
    Med
    Diff
    StdDev
    Range
)

func FromArchive Uses

func FromArchive(archive schema.Method) Consolidator

func FromConsolidateBy Uses

func FromConsolidateBy(c string) Consolidator

FromConsolidateBy returns a consolidator based on a "consolidateBy" string for any string allowed by Validate(), or None otherwise. note that we also recognize "lst" here whereas Validate() doesn't, which does not violate the above statement.

func (Consolidator) Archive Uses

func (c Consolidator) Archive() schema.Method

provide the name of a stored archive see aggregator.go for which archives are available

func (*Consolidator) DecodeMsg Uses

func (z *Consolidator) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Consolidator) EncodeMsg Uses

func (z Consolidator) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Consolidator) MarshalMsg Uses

func (z Consolidator) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Consolidator) Msgsize Uses

func (z Consolidator) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (Consolidator) String Uses

func (c Consolidator) String() string

String provides human friendly names

func (*Consolidator) UnmarshalMsg Uses

func (z *Consolidator) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Package consolidation imports 6 packages (graph) and is imported by 12 packages. Updated 2020-07-04. Refresh now. Tools for package owners.