Documentation ¶
Index ¶
- Variables
- func AggKey(arg *types.MetricData, nodesOrTags []parser.NodeOrTag) string
- func AggregateSeries(e parser.Expr, args []*types.MetricData, function AggregateFunc, ...) ([]*types.MetricData, error)
- func AlignSeries(args []*types.MetricData) []*types.MetricData
- func AlignStartToInterval(start, stop, bucketSize int64) int64
- func AlignToBucketSize(start, stop, bucketSize int64) (int64, int64)
- func ConsolidateSeriesByStep(numerator, denominator *types.MetricData) (*types.MetricData, *types.MetricData)
- func Contains(a []int, i int) bool
- func CopyTags(series *types.MetricData) map[string]string
- func Divmod(numerator, denominator int64) (quotient, remainder int64)
- func ForEachSeriesDo(ctx context.Context, eval interfaces.Evaluator, e parser.Expr, ...) ([]*types.MetricData, error)
- func ForEachSeriesDo1(ctx context.Context, eval interfaces.Evaluator, e parser.Expr, ...) ([]*types.MetricData, error)
- func FormatUnits(v float64, system string) (float64, string)
- func GCD(a, b int64) int64
- func GetBuckets(start, stop, bucketSize int64) int64
- func GetCommonStep(args []*types.MetricData) (commonStep int64, changed bool)
- func GetCommonTags(series []*types.MetricData) map[string]string
- func GetInterval(args []*types.MetricData) (minStartTime, maxStopTime int64)
- func GetSeriesArg(ctx context.Context, eval interfaces.Evaluator, arg parser.Expr, ...) ([]*types.MetricData, error)
- func GetSeriesArgs(ctx context.Context, eval interfaces.Evaluator, e []parser.Expr, ...) ([]*types.MetricData, error)
- func GetSeriesArgsAndRemoveNonExisting(ctx context.Context, eval interfaces.Evaluator, e parser.Expr, ...) ([]*types.MetricData, error)
- func GetStepRange(args []*types.MetricData) (minStep, maxStep int64, needScale bool)
- func LCM(args ...int64) int64
- func RemoveEmptySeriesFromName(args []*types.MetricData) string
- func SafeRound(x float64, precision int) float64
- func ScaleSeries(args []*types.MetricData) []*types.MetricData
- func ScaleToCommonStep(args []*types.MetricData, commonStep int64) []*types.MetricData
- func ScaleValuesToCommonStep(values map[parser.MetricRequest][]*types.MetricData) map[parser.MetricRequest][]*types.MetricData
- func XFilesFactor(nonNull int, total int, xFilesFactor float64) bool
- func XFilesFactorValues(values []float64, xFilesFactor float64) bool
- type AggregateFunc
- type ByName
- type ByNameNatural
- type ByVals
- type ErrUnknownFunction
Constants ¶
This section is empty.
Variables ¶
var Backref = regexp.MustCompile(`\\(\d+)`)
Backref is a pre-compiled expression for backref
var ExtrapolatePoints = false
ExtrapolatePoints defines if we should extrapolate when we are aligning series together
var UnitSystems = map[string][]unitPrefix{ // contains filtered or unexported fields }
Functions ¶
func AggKey ¶ added in v0.14.0
func AggKey(arg *types.MetricData, nodesOrTags []parser.NodeOrTag) string
AggKey returns joined by dot nodes of tags names
func AggregateSeries ¶
func AggregateSeries(e parser.Expr, args []*types.MetricData, function AggregateFunc, xFilesFactor float64, extractTagsFromArgs bool) ([]*types.MetricData, error)
AggregateSeries aggregates series
func AlignSeries ¶
func AlignSeries(args []*types.MetricData) []*types.MetricData
AlignSeries aligns different series together. By default it only prepends and appends NaNs in case of different length, but if ExtrapolatePoints is enabled, it can extrapolate
func AlignStartToInterval ¶
AlignStartToInterval aligns start of serie to interval
func AlignToBucketSize ¶
AlignToBucketSize aligns start and stop of serie to specified bucket (step) size
func ConsolidateSeriesByStep ¶ added in v0.16.0
func ConsolidateSeriesByStep(numerator, denominator *types.MetricData) (*types.MetricData, *types.MetricData)
func CopyTags ¶ added in v0.16.0
func CopyTags(series *types.MetricData) map[string]string
CopyTags makes a deep copy of the tags
func ForEachSeriesDo ¶
func ForEachSeriesDo(ctx context.Context, eval interfaces.Evaluator, e parser.Expr, from, until int64, values map[parser.MetricRequest][]*types.MetricData, function seriesFunc) ([]*types.MetricData, error)
ForEachSeriesDo do action for each serie in list.
func ForEachSeriesDo1 ¶ added in v0.16.0
func ForEachSeriesDo1(ctx context.Context, eval interfaces.Evaluator, e parser.Expr, from, until int64, values map[parser.MetricRequest][]*types.MetricData, function seriesFunc1) ([]*types.MetricData, error)
ForEachSeriesDo do action for each serie in list.
func FormatUnits ¶ added in v0.16.0
formatUnits formats the given value according to the given unit prefix system
func GetBuckets ¶
GetBuckets returns amount buckets for timeSeries (defined with startTime, stopTime and step (bucket) size.
func GetCommonStep ¶ added in v0.14.1
func GetCommonStep(args []*types.MetricData) (commonStep int64, changed bool)
GetCommonStep returns LCM(steps), changed (bool) for slice of metrics. If all metrics have the same step, changed == false.
func GetCommonTags ¶ added in v0.16.0
func GetCommonTags(series []*types.MetricData) map[string]string
func GetInterval ¶ added in v0.16.0
func GetInterval(args []*types.MetricData) (minStartTime, maxStopTime int64)
GetInterval returns minStartTime, maxStartTime for slice of metrics.
func GetSeriesArg ¶
func GetSeriesArg(ctx context.Context, eval interfaces.Evaluator, arg parser.Expr, from, until int64, values map[parser.MetricRequest][]*types.MetricData) ([]*types.MetricData, error)
GetSeriesArg returns argument from series.
func GetSeriesArgs ¶
func GetSeriesArgs(ctx context.Context, eval interfaces.Evaluator, e []parser.Expr, from, until int64, values map[parser.MetricRequest][]*types.MetricData) ([]*types.MetricData, error)
GetSeriesArgs returns arguments of series
func GetSeriesArgsAndRemoveNonExisting ¶
func GetSeriesArgsAndRemoveNonExisting(ctx context.Context, eval interfaces.Evaluator, e parser.Expr, from, until int64, values map[parser.MetricRequest][]*types.MetricData) ([]*types.MetricData, error)
GetSeriesArgsAndRemoveNonExisting will fetch all required arguments, but will also filter out non existing Series This is needed to be graphite-web compatible in cases when you pass non-existing Series to, for example, sumSeries
func GetStepRange ¶ added in v0.16.0
func GetStepRange(args []*types.MetricData) (minStep, maxStep int64, needScale bool)
GetStepRange returns min(steps), changed (bool) for slice of metrics. If all metrics have the same step, changed == false.
func RemoveEmptySeriesFromName ¶
func RemoveEmptySeriesFromName(args []*types.MetricData) string
RemoveEmptySeriesFromName removes empty series from list of names.
func ScaleSeries ¶ added in v0.16.0
func ScaleSeries(args []*types.MetricData) []*types.MetricData
ScaleSeries aligns and scale different series together. By default it only prepends and appends NaNs in case of different length, but if ExtrapolatePoints is enabled, it can extrapolate
func ScaleToCommonStep ¶ added in v0.14.1
func ScaleToCommonStep(args []*types.MetricData, commonStep int64) []*types.MetricData
ScaleToCommonStep returns the metrics, aligned LCM of all metrics steps. If commonStep == 0, then it will be calculated automatically It respects xFilesFactor and fills gaps in the begin and end with NaNs if needed.
func ScaleValuesToCommonStep ¶ added in v0.14.1
func ScaleValuesToCommonStep(values map[parser.MetricRequest][]*types.MetricData) map[parser.MetricRequest][]*types.MetricData
ScaleValuesToCommonStep returns map[parser.MetricRequest][]*types.MetricData. If any element of []*types.MetricData is changed, it doesn't change original metric, but creates the new one to avoid cache spoiling.
func XFilesFactor ¶ added in v0.16.0
func XFilesFactorValues ¶ added in v0.16.0
Types ¶
type AggregateFunc ¶
AggregateFunc type that defined aggregate function
type ByName ¶
type ByName []*types.MetricData
ByName sorts metrics by name
type ByNameNatural ¶
type ByNameNatural []*types.MetricData
ByNameNatural sorts metric naturally by name
func (ByNameNatural) Len ¶
func (s ByNameNatural) Len() int
Len returns length, required to be sortable
func (ByNameNatural) Less ¶
func (s ByNameNatural) Less(i, j int) bool
Less compares two elements with specified IDs, required to be sortable
func (ByNameNatural) Swap ¶
func (s ByNameNatural) Swap(i, j int)
Swap swaps to elements by IDs, required to be sortable
type ByVals ¶
type ByVals struct { Vals []float64 Series []*types.MetricData }
ByVals sorts by values Total (sortByTotal), max (sortByMaxima), min (sortByMinima) sorting For 'min', we actually store 1/v so the sorting logic is the same
type ErrUnknownFunction ¶
type ErrUnknownFunction string
ErrUnknownFunction is an error message about unknown function
func (ErrUnknownFunction) Error ¶
func (e ErrUnknownFunction) Error() string