Documentation ¶
Index ¶
- Variables
- 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 AvgValue(f64s []float64) float64
- func Contains(a []int, i int) bool
- func CurrentValue(f64s []float64) float64
- func ExtractMetric(s string) string
- func ExtractTags(s string) map[string]string
- func ForEachSeriesDo(e parser.Expr, from, until int64, ...) ([]*types.MetricData, error)
- func GetBuckets(start, stop, bucketSize int64) int64
- func GetSeriesArg(arg parser.Expr, from, until int64, ...) ([]*types.MetricData, error)
- func GetSeriesArgs(e []parser.Expr, from, until int64, ...) ([]*types.MetricData, error)
- func GetSeriesArgsAndRemoveNonExisting(e parser.Expr, from, until int64, ...) ([]*types.MetricData, error)
- func MaxValue(f64s []float64) float64
- func MinValue(f64s []float64) float64
- func Percentile(data []float64, percent float64, interpolate bool) float64
- func Poly(x float64, coeffs ...float64) float64
- func RemoveEmptySeriesFromName(args []*types.MetricData) string
- func SetEvaluator(e interfaces.Evaluator)
- func SummarizeValues(f string, values []float64) float64
- func Vandermonde(absent []float64, deg int) *mat.Dense
- func VarianceValue(f64s []float64) float64
- type AggregateFunc
- type ByName
- type ByNameNatural
- type ByVals
- type ErrUnknownFunction
Constants ¶
This section is empty.
Variables ¶
var AvailableSummarizers = []string{"sum", "total", "avg", "average", "avg_zero", "max", "min", "last", "range", "median", "multiply", "diff", "count", "stddev"}
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
Functions ¶
func AggregateSeries ¶
func AggregateSeries(e parser.Expr, args []*types.MetricData, function AggregateFunc) ([]*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 CurrentValue ¶
CurrentValue returns last non-absent value (if any), otherwise returns NaN
func ExtractMetric ¶
ExtractMetric extracts metric out of function list
func ExtractTags ¶
ExtractTags extracts all graphite-style tags out of metric name E.x. cpu.usage_idle;cpu=cpu-total;host=test => {"name": "cpu.usage_idle", "cpu": "cpu-total", "host": "test"}
func ForEachSeriesDo ¶
func ForEachSeriesDo(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 GetBuckets ¶
GetBuckets returns amount buckets for timeSeries (defined with startTime, stopTime and step (bucket) size.
func GetSeriesArg ¶
func GetSeriesArg(arg parser.Expr, from, until int64, values map[parser.MetricRequest][]*types.MetricData) ([]*types.MetricData, error)
GetSeriesArg returns argument from series.
func GetSeriesArgs ¶
func GetSeriesArgs(e []parser.Expr, from, until int64, values map[parser.MetricRequest][]*types.MetricData) ([]*types.MetricData, error)
GetSeriesArgs returns arguments of series
func GetSeriesArgsAndRemoveNonExisting ¶
func GetSeriesArgsAndRemoveNonExisting(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 Percentile ¶
Percentile returns percent-th percentile. Can interpolate if needed
func RemoveEmptySeriesFromName ¶
func RemoveEmptySeriesFromName(args []*types.MetricData) string
RemoveEmptySeriesFromName removes empty series from list of names.
func SetEvaluator ¶
func SetEvaluator(e interfaces.Evaluator)
SetEvaluator sets evaluator for all helper functions
func SummarizeValues ¶
SummarizeValues summarizes values
func Vandermonde ¶
Vandermonde creates a Vandermonde matrix
func VarianceValue ¶
VarianceValue gets variances of list of values
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