expr

package
v0.0.0-...-7afe134 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2014 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownOp = fmt.Errorf("expr: unknown op type")

Functions

This section is empty.

Types

type AlertKey

type AlertKey string

func NewAlertKey

func NewAlertKey(name string, group opentsdb.TagSet) AlertKey

func ParseAlertKey

func ParseAlertKey(a string) (ak AlertKey, err error)

func (AlertKey) Group

func (a AlertKey) Group() opentsdb.TagSet

Group returns the tagset of this alert key. Will panic if a is not a valid AlertKey. OpenTSDB tag validation errors are ignored.

func (AlertKey) Name

func (a AlertKey) Name() string

type AlertKeys

type AlertKeys []AlertKey

func (AlertKeys) Len

func (a AlertKeys) Len() int

func (AlertKeys) Less

func (a AlertKeys) Less(i, j int) bool

func (AlertKeys) Swap

func (a AlertKeys) Swap(i, j int)

type Computation

type Computation struct {
	Text  string
	Value interface{}
}

type Computations

type Computations []Computation

type Entry

type Entry struct {
	AlertKey AlertKey
	Values   map[string]string
}

type Expr

type Expr struct {
	*parse.Tree
}

func New

func New(expr string) (*Expr, error)

func (*Expr) Execute

func (e *Expr) Execute(c opentsdb.Context, T miniprofiler.Timer, now time.Time, autods int, unjoinedOk bool, search *search.Search, lookups map[string]*Lookup, squelched func(tags opentsdb.TagSet) bool) (r *Results, queries []opentsdb.Request, err error)

Execute applies a parse expression to the specified OpenTSDB context, and returns one result per group. T may be nil to ignore timings.

func (*Expr) MarshalJSON

func (e *Expr) MarshalJSON() ([]byte, error)

type Lookup

type Lookup struct {
	Tags    []string
	Entries []*Entry
}

func (*Lookup) Get

func (lookup *Lookup) Get(key string, tag opentsdb.TagSet) (value string, ok bool)

type Number

type Number float64

func (Number) MarshalJSON

func (n Number) MarshalJSON() ([]byte, error)

func (Number) Type

func (n Number) Type() parse.FuncType

func (Number) Value

func (n Number) Value() interface{}

type Result

type Result struct {
	Computations
	Value
	Group opentsdb.TagSet
}

func (*Result) AddComputation

func (r *Result) AddComputation(text string, value interface{})

type Results

type Results struct {
	Results []*Result
	// If true, ungrouped joins from this set will be ignored.
	IgnoreUnjoined bool
	// If true, ungrouped joins from the other set will be ignored.
	IgnoreOtherUnjoined bool
	// If non nil, will set any NaN value to it.
	NaNValue *float64
}

func Abs

func Abs(e *state, T miniprofiler.Timer, series *Results) *Results

func Avg

func Avg(e *state, T miniprofiler.Timer, series *Results) (*Results, error)

func Band

func Band(e *state, T miniprofiler.Timer, query, duration, period string, num float64) (r *Results, err error)

func Change

func Change(e *state, T miniprofiler.Timer, query, sduration, eduration string) (r *Results, err error)

func Count

func Count(e *state, T miniprofiler.Timer, query, sduration, eduration string) (r *Results, err error)

func Dev

func Dev(e *state, T miniprofiler.Timer, series *Results) (*Results, error)

func Diff

func Diff(e *state, T miniprofiler.Timer, query, sduration, eduration string) (r *Results, err error)

func DropNA

func DropNA(e *state, T miniprofiler.Timer, series *Results) (*Results, error)

func First

func First(e *state, T miniprofiler.Timer, series *Results) (*Results, error)

func Forecast_lr

func Forecast_lr(e *state, T miniprofiler.Timer, series *Results, y float64) (r *Results, err error)

func Last

func Last(e *state, T miniprofiler.Timer, series *Results) (*Results, error)

func Length

func Length(e *state, T miniprofiler.Timer, series *Results) (*Results, error)

func Max

func Max(e *state, T miniprofiler.Timer, series *Results) (r *Results, err error)

func Median

func Median(e *state, T miniprofiler.Timer, series *Results) (r *Results, err error)

func Min

func Min(e *state, T miniprofiler.Timer, series *Results) (r *Results, err error)

func NV

func NV(e *state, T miniprofiler.Timer, series *Results, v float64) (results *Results, err error)

func Percentile

func Percentile(e *state, T miniprofiler.Timer, series *Results, p float64) (r *Results, err error)

func Query

func Query(e *state, T miniprofiler.Timer, query, sduration, eduration string) (r *Results, err error)

func Since

func Since(e *state, T miniprofiler.Timer, series *Results) (*Results, error)

func Sum

func Sum(e *state, T miniprofiler.Timer, series *Results) (*Results, error)

func Transpose

func Transpose(e *state, T miniprofiler.Timer, d *Results, gp string) (*Results, error)

func Ungroup

func Ungroup(e *state, T miniprofiler.Timer, d *Results) (*Results, error)

func (*Results) NaN

func (r *Results) NaN() Number

type Scalar

type Scalar float64

func (Scalar) MarshalJSON

func (s Scalar) MarshalJSON() ([]byte, error)

func (Scalar) Type

func (s Scalar) Type() parse.FuncType

func (Scalar) Value

func (s Scalar) Value() interface{}

type Series

type Series map[string]opentsdb.Point

func (Series) Type

func (s Series) Type() parse.FuncType

func (Series) Value

func (s Series) Value() interface{}

type Union

type Union struct {
	Computations
	A, B  Value
	Group opentsdb.TagSet
}

func (*Union) ExtendComputations

func (u *Union) ExtendComputations(o *Result)

type Value

type Value interface {
	Type() parse.FuncType
	Value() interface{}
}

Directories

Path Synopsis
Package parse builds parse trees for expressions as defined by expr.
Package parse builds parse trees for expressions as defined by expr.

Jump to

Keyboard shortcuts

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