rollup

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 18 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 {
	RuleType  RuleType    `json:"rule_type"`
	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 {
	RuleType  RuleType        `xml:"rule_type"`
	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, tlsConfig *tls.Config, 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 RuleType added in v0.14.0

type RuleType uint8
const (
	RuleAll RuleType = iota
	RulePlain
	RuleTagged
	RuleTagList
)

func (*RuleType) Set added in v0.14.0

func (r *RuleType) Set(value string) error

func (*RuleType) String added in v0.14.0

func (r *RuleType) String() string

func (*RuleType) UnmarshalJSON added in v0.14.0

func (r *RuleType) UnmarshalJSON(data []byte) error

func (*RuleType) UnmarshalXML added in v0.14.0

func (r *RuleType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Rules added in v0.9.0

type Rules struct {
	Pattern       []Pattern `json:"pattern"`
	Updated       int64     `json:"updated"`
	Separated     bool      `json:"-"`
	PatternPlain  []Pattern `json:"-"`
	PatternTagged []Pattern `json:"-"`
}

func NewMockRules added in v0.13.0

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

NewMockRulles creates mock rollup for tests

func RemoteLoad added in v0.14.0

func RemoteLoad(addr string, tlsConf *tls.Config, table string) (*Rules, error)

func (*Rules) Lookup added in v0.11.6

func (r *Rules) Lookup(metric string, age uint32, verbose bool) (precision uint32, ag *Aggr, aggrPattern, retentionPattern *Pattern)

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, verbose bool) (precision uint32, ag *Aggr, aggrPattern, retentionPattern *Pattern)

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