expr

package
v0.0.0-...-f0721d9 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: GPL-3.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingExpr is a parse error returned when an expression is missing.
	ErrMissingExpr = errors.New("missing expression")
	// ErrMissingComma is a parse error returned when an expression is missing a comma.
	ErrMissingComma = errors.New("missing comma")
	// ErrMissingQuote is a parse error returned when an expression is missing a quote.
	ErrMissingQuote = errors.New("missing quote")
	// ErrUnexpectedCharacter is a parse error returned when an expression contains an unexpected character.
	ErrUnexpectedCharacter = errors.New("unexpected character")
)
View Source
var (
	// ErrBadType is an eval error returned when a argument has wrong type.
	ErrBadType = errors.New("bad type")
	// ErrMissingArgument is an eval error returned when a argument is missing.
	ErrMissingArgument = errors.New("missing argument")
	// ErrMissingTimeseries is an eval error returned when a time series argument is missing.
	ErrMissingTimeseries = errors.New("missing time series argument")
	// ErrSeriesDoesNotExist is an eval error returned when a requested time series argument does not exist.
	ErrSeriesDoesNotExist = errors.New("no timeseries with that name")
)
View Source
var (
	// ErrWildcardNotAllowed is an eval error returned when a wildcard/glob argument is found where a single series is required.
	ErrWildcardNotAllowed = errors.New("found wildcard where series expected")
	// ErrTooManyArguments is an eval error returned when too many arguments are provided.
	ErrTooManyArguments = errors.New("too many arguments")
)

Functions

func AlphabeticallyByPart

func AlphabeticallyByPart(metrics []*MetricData, part int) sort.Interface

AlphabeticallyByPart returns a byPartAlphabetical that will sort 'metrics' alphabetically by 'part'.

func ByPart

func ByPart(metrics []*MetricData, part int) byPartBase

ByPart returns a byPartBase suitable for sorting 'metrics' by 'part'.

func ConsolidateJSON

func ConsolidateJSON(maxDataPoints int, results []*MetricData)

func IntervalString

func IntervalString(s string, defaultSign int) (int32, error)

IntervalString converts a sign and string into a number of seconds

func MarshalCSV

func MarshalCSV(results []*MetricData) []byte

func MarshalJSON

func MarshalJSON(results []*MetricData) []byte

func MarshalPNG

func MarshalPNG(r *http.Request, results []*MetricData) []byte

func MarshalPickle

func MarshalPickle(results []*MetricData) []byte

func MarshalProtobuf

func MarshalProtobuf(results []*MetricData) ([]byte, error)

func MarshalRaw

func MarshalRaw(results []*MetricData) []byte

func MarshalSVG

func MarshalSVG(r *http.Request, results []*MetricData) []byte

func ParseExpr

func ParseExpr(e string) (*expr, string, error)

func SortMetrics

func SortMetrics(metrics []*MetricData, mfetch MetricRequest)

func TruthyBool

func TruthyBool(s string) bool

Types

type ByName

type ByName []*MetricData

ByName sorts metrics by name

func (ByName) Len

func (s ByName) Len() int

func (ByName) Less

func (s ByName) Less(i, j int) bool

func (ByName) Swap

func (s ByName) Swap(i, j int)

type ByNameNatural

type ByNameNatural []*MetricData

ByNameNatural sorts metric naturally by name

func (ByNameNatural) Len

func (s ByNameNatural) Len() int

func (ByNameNatural) Less

func (s ByNameNatural) Less(i, j int) bool

func (ByNameNatural) Swap

func (s ByNameNatural) Swap(i, j int)

type MetricData

type MetricData struct {
	pb.FetchResponse
	// contains filtered or unexported fields
}

func EvalExpr

func EvalExpr(e *expr, from, until int32, values map[MetricRequest][]*MetricData) ([]*MetricData, error)

func (*MetricData) AggregateValues

func (r *MetricData) AggregateValues()

func (*MetricData) AggregatedAbsent

func (r *MetricData) AggregatedAbsent() []bool

func (*MetricData) AggregatedTimeStep

func (r *MetricData) AggregatedTimeStep() int32

func (*MetricData) AggregatedValues

func (r *MetricData) AggregatedValues() []float64

type MetricRequest

type MetricRequest struct {
	Metric string
	From   int32
	Until  int32
}

Jump to

Keyboard shortcuts

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