expr

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2017 License: BSD-2-Clause Imports: 23 Imported by: 5

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 added in v0.6.0

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

func IntervalString added in v0.6.0

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

IntervalString converts a sign and string into a number of seconds

func MarshalCSV added in v0.6.0

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

func MarshalJSON added in v0.6.0

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

func MarshalPNG added in v0.6.0

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

func MarshalPickle added in v0.6.0

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

func MarshalProtobuf added in v0.6.0

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

func MarshalRaw added in v0.6.0

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

func MarshalSVG added in v0.6.0

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

func ParseExpr added in v0.6.0

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

func SortMetrics

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

func TruthyBool added in v0.6.0

func TruthyBool(s string) bool

Types

type ByName added in v0.6.0

type ByName []*MetricData

ByName sorts metrics by name

func (ByName) Len added in v0.6.0

func (s ByName) Len() int

func (ByName) Less added in v0.6.0

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

func (ByName) Swap added in v0.6.0

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

type ByNameNatural added in v0.6.0

type ByNameNatural []*MetricData

ByNameNatural sorts metric naturally by name

func (ByNameNatural) Len added in v0.6.0

func (s ByNameNatural) Len() int

func (ByNameNatural) Less added in v0.6.0

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

func (ByNameNatural) Swap added in v0.6.0

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

type MetricData added in v0.6.0

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 added in v0.6.0

func (r *MetricData) AggregateValues()

func (*MetricData) AggregatedAbsent added in v0.6.0

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

func (*MetricData) AggregatedTimeStep added in v0.6.0

func (r *MetricData) AggregatedTimeStep() int32

func (*MetricData) AggregatedValues added in v0.6.0

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

type MetricRequest added in v0.6.0

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