rollup

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AggrMap = map[string]*Aggr{
	"avg":     &Aggr{"avg", AggrAvg},
	"max":     &Aggr{"max", AggrMax},
	"min":     &Aggr{"min", AggrMin},
	"sum":     &Aggr{"sum", AggrSum},
	"any":     &Aggr{"any", AggrAny},
	"anyLast": &Aggr{"anyLast", AggrAnyLast},
}

Functions

func AggrAny

func AggrAny(points []point.Point) (r float64)

func AggrAnyLast

func AggrAnyLast(points []point.Point) (r float64)

func AggrAvg

func AggrAvg(points []point.Point) (r float64)

func AggrMax

func AggrMax(points []point.Point) (r float64)

func AggrMin

func AggrMin(points []point.Point) (r float64)

func AggrSum

func AggrSum(points []point.Point) (r float64)

Types

type Aggr added in v0.9.0

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

func (*Aggr) Do added in v0.9.0

func (ag *Aggr) Do(points []point.Point) (r float64)

func (*Aggr) Name added in v0.9.0

func (ag *Aggr) Name() string

func (*Aggr) String added in v0.11.6

func (ag *Aggr) String() string

type ClickhouseRollupXML added in v0.11.6

type ClickhouseRollupXML struct {
	Rules RulesXML `xml:"graphite_rollup"`
}

type Pattern

type Pattern struct {
	Regexp    string      `json:"regexp"`
	Function  string      `json:"function"`
	Retention []Retention `json:"retention"`
	// contains filtered or unexported fields
}

type PatternXML added in v0.11.6

type PatternXML struct {
	Regexp    string          `xml:"regexp"`
	Function  string          `xml:"function"`
	Retention []*RetentionXML `xml:"retention"`
}

type Retention

type Retention struct {
	Age       uint32 `json:"age"`
	Precision uint32 `json:"precision"`
}

type RetentionXML added in v0.11.6

type RetentionXML struct {
	Age       uint32 `xml:"age"`
	Precision uint32 `xml:"precision"`
}

type Rollup

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

func NewAuto added in v0.11.6

func NewAuto(addr string, table string, interval time.Duration, defaultPrecision uint32, defaultFunction string) (*Rollup, error)

func NewDefault added in v0.11.6

func NewDefault(defaultPrecision uint32, defaultFunction string) (*Rollup, error)

func NewXMLFile added in v0.11.6

func NewXMLFile(filename string, defaultPrecision uint32, defaultFunction string) (*Rollup, error)

func (*Rollup) MarshalJSON added in v0.9.0

func (r *Rollup) MarshalJSON() ([]byte, error)

func (*Rollup) Rules added in v0.9.0

func (r *Rollup) Rules() *Rules

type Rules added in v0.9.0

type Rules struct {
	Pattern []Pattern `json:"pattern"`
	Updated int64     `json:"updated"`
}

func NewMockRules added in v0.13.0

func NewMockRules(pattern []Pattern, defaultPrecision uint32, defaultFunction string) (*Rules, error)

NewMockRulles creates mock rollup for tests

func (*Rules) Lookup added in v0.11.6

func (r *Rules) Lookup(metric string, age uint32) (precision uint32, ag *Aggr)

Lookup returns precision and aggregate function for metric name and age

func (*Rules) LookupBytes added in v0.11.6

func (r *Rules) LookupBytes(metric []byte, age uint32) (precision uint32, ag *Aggr)

LookupBytes returns precision and aggregate function for metric name and age

func (*Rules) RollupMetric added in v0.9.0

func (r *Rules) RollupMetric(metricName string, from uint32, points []point.Point) ([]point.Point, uint32, error)

RollupMetric rolling up list of points of ONE metric sorted by key "time" returns (new points slice, precision)

func (*Rules) RollupMetricAge added in v0.11.6

func (r *Rules) RollupMetricAge(metricName string, age uint32, points []point.Point) ([]point.Point, uint32, error)

RollupMetricAge rolling up list of points of ONE metric sorted by key "time" returns (new points slice, precision)

func (*Rules) RollupPoints added in v0.12.0

func (r *Rules) RollupPoints(pp *point.Points, from int64, step int64) error

RollupPoints groups sorted Points by metric name and apply rollup one by one. If the `step` parameter is 0, it will be got from the current *Rules, otherwise it will be used directly.

type RulesXML added in v0.11.6

type RulesXML struct {
	Pattern []*PatternXML `xml:"pattern"`
	Default *PatternXML   `xml:"default"`
}

Jump to

Keyboard shortcuts

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