expr

package
v0.0.0-...-c7bed9c Latest Latest
Warning

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

Go to latest
Published: May 16, 2017 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Annotate = map[string]parse.Func{

	"ancounts": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString},
		Return: models.TypeSeriesSet,
		Tags:   tagFirst,
		F:      AnCounts,
	},
	"andurations": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString},
		Return: models.TypeSeriesSet,
		Tags:   tagFirst,
		F:      AnDurations,
	},
	"antable": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeString},
		Return: models.TypeTable,
		F:      AnTable,
	},
}
View Source
var Elastic = map[string]parse.Func{

	"escount": {
		Args:          []models.FuncType{models.TypeESIndexer, models.TypeString, models.TypeESQuery, models.TypeString, models.TypeString, models.TypeString},
		Return:        models.TypeSeriesSet,
		Tags:          elasticTagQuery,
		F:             ESCount,
		PrefixEnabled: true,
	},
	"esstat": {
		Args:          []models.FuncType{models.TypeESIndexer, models.TypeString, models.TypeESQuery, models.TypeString, models.TypeString, models.TypeString, models.TypeString, models.TypeString},
		Return:        models.TypeSeriesSet,
		Tags:          elasticTagQuery,
		F:             ESStat,
		PrefixEnabled: true,
	},

	"esindices": {
		Args:     []models.FuncType{models.TypeString, models.TypeString},
		VArgs:    true,
		VArgsPos: 1,
		Return:   models.TypeESIndexer,
		F:        ESIndicies,
	},
	"esdaily": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString},
		Return: models.TypeESIndexer,
		F:      ESDaily,
	},
	"esmonthly": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString},
		Return: models.TypeESIndexer,
		F:      ESMonthly,
	},
	"esls": {
		Args:   []models.FuncType{models.TypeString},
		Return: models.TypeESIndexer,
		F:      ESLS,
	},

	"esall": {
		Args:   []models.FuncType{},
		Return: models.TypeESQuery,
		F:      ESAll,
	},
	"esregexp": {
		Args:   []models.FuncType{models.TypeString, models.TypeString},
		Return: models.TypeESQuery,
		F:      ESRegexp,
	},
	"esquery": {
		Args:   []models.FuncType{models.TypeString, models.TypeString},
		Return: models.TypeESQuery,
		F:      ESQueryString,
	},
	"esexists": {
		Args:   []models.FuncType{models.TypeString},
		Return: models.TypeESQuery,
		F:      ESExists,
	},
	"esand": {
		Args:   []models.FuncType{models.TypeESQuery},
		VArgs:  true,
		Return: models.TypeESQuery,
		F:      ESAnd,
	},
	"esor": {
		Args:   []models.FuncType{models.TypeESQuery},
		VArgs:  true,
		Return: models.TypeESQuery,
		F:      ESOr,
	},
	"esnot": {
		Args:   []models.FuncType{models.TypeESQuery},
		Return: models.TypeESQuery,
		F:      ESNot,
	},
	"esgt": {
		Args:   []models.FuncType{models.TypeString, models.TypeScalar},
		Return: models.TypeESQuery,
		F:      ESGT,
	},
	"esgte": {
		Args:   []models.FuncType{models.TypeString, models.TypeScalar},
		Return: models.TypeESQuery,
		F:      ESGTE,
	},
	"eslt": {
		Args:   []models.FuncType{models.TypeString, models.TypeScalar},
		Return: models.TypeESQuery,
		F:      ESLT,
	},
	"eslte": {
		Args:   []models.FuncType{models.TypeString, models.TypeScalar},
		Return: models.TypeESQuery,
		F:      ESLTE,
	},
}

ElasticFuncs are specific functions that query an elasticsearch instance. They are only loaded when the elastic hosts are set in the config file

View Source
var ErrUnknownOp = fmt.Errorf("expr: unknown op type")
View Source
var Graphite = map[string]parse.Func{
	"graphiteBand": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeString, models.TypeScalar},
		Return: models.TypeSeriesSet,
		Tags:   graphiteTagQuery,
		F:      GraphiteBand,
	},
	"graphite": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeString},
		Return: models.TypeSeriesSet,
		Tags:   graphiteTagQuery,
		F:      GraphiteQuery,
	},
}

Graphite defines functions for use with a Graphite backend.

Influx is a map of functions to query InfluxDB.

The following are specific functions that query an elastic instance populated by logstash. They are only loaded when the elastic hosts are set in the config file

View Source
var TSDB = map[string]parse.Func{
	"band": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeScalar},
		Return: models.TypeSeriesSet,
		Tags:   tagQuery,
		F:      Band,
	},
	"shiftBand": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeScalar},
		Return: models.TypeSeriesSet,
		Tags:   tagQuery,
		F:      ShiftBand,
	},
	"over": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeScalar},
		Return: models.TypeSeriesSet,
		Tags:   tagQuery,
		F:      Over,
	},
	"change": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString},
		Return: models.TypeNumberSet,
		Tags:   tagQuery,
		F:      Change,
	},
	"count": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString},
		Return: models.TypeScalar,
		F:      Count,
	},
	"q": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString},
		Return: models.TypeSeriesSet,
		Tags:   tagQuery,
		F:      Query,
	},
	"window": {
		Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeScalar, models.TypeString},
		Return: models.TypeSeriesSet,
		Tags:   tagQuery,
		F:      Window,
		Check:  windowCheck,
	},
}

TSDB defines functions for use with an OpenTSDB backend.

Functions

func ProcessLSKeys

func ProcessLSKeys(keystring, filter string, filtered *elastic.FilteredQuery) ([]lsKeyMatch, error)

This creates the elastic filter porition of a query

func ScopeES

func ScopeES(ts opentsdb.TagSet, q elastic.Query) elastic.Query

Types

type AlertStatusProvider

type AlertStatusProvider interface {
	GetUnknownAndUnevaluatedAlertKeys(alertName string) (unknown, unevaluated []models.AlertKey)
}

Alert Status Provider is used to provide information about alert results. This facilitates alerts referencing other alerts, even when they go unknown or unevaluated.

type Backends

type Backends struct {
	TSDBContext     opentsdb.Context
	GraphiteContext graphite.Context
	LogstashHosts   LogstashElasticHosts
	ElasticHosts    ElasticHosts
	InfluxConfig    client.HTTPConfig
	ElasticConfig   ElasticConfig
}

type BosunProviders

type BosunProviders struct {
	Squelched func(tags opentsdb.TagSet) bool
	Search    *search.Search
	History   AlertStatusProvider
	Cache     *cache.Cache
	Annotate  backend.Backend
}

type ESIndexer

type ESIndexer struct {
	TimeField string
	Generate  func(startDuration, endDuration *time.Time) []string
}

func (ESIndexer) MarshalJSON

func (e ESIndexer) MarshalJSON() ([]byte, error)

func (ESIndexer) Type

func (e ESIndexer) Type() models.FuncType

func (ESIndexer) Value

func (e ESIndexer) Value() interface{}

type ESQuery

type ESQuery struct {
	Query elastic.Query
}

func (ESQuery) MarshalJSON

func (e ESQuery) MarshalJSON() ([]byte, error)

func (ESQuery) Type

func (e ESQuery) Type() models.FuncType

func (ESQuery) Value

func (e ESQuery) Value() interface{}

type ElasticConfig

type ElasticConfig struct {
	Hosts             []string
	SimpleClient      bool
	ClientOptionFuncs []elastic.ClientOptionFunc
}

type ElasticHosts

type ElasticHosts struct {
	Hosts map[string]ElasticConfig
}

ElasticHosts is an array of Logstash hosts and exists as a type for something to attach methods to. The elasticsearch library will use the listed to hosts to discover all of the hosts in the config type ElasticHosts []string

func (ElasticHosts) InitClient

func (e ElasticHosts) InitClient(prefix string) error

InitClient sets up the elastic client. If the client has already been initialized it is a noop

func (ElasticHosts) Query

Query takes a Logstash request, applies it a search service, and then queries elasticsearch.

type ElasticRequest

type ElasticRequest struct {
	Indices []string
	HostKey string
	Start   *time.Time
	End     *time.Time
	Source  *elastic.SearchSource // This the object that we build queries in
}

ElasticRequest is a container for the information needed to query elasticsearch or a date histogram.

func ESBaseQuery

func ESBaseQuery(now time.Time, indexer ESIndexer, filter elastic.Query, sduration, eduration string, size int, prefix string) (*ElasticRequest, error)

ESBaseQuery builds the base query that both ESCount and ESStat share

func (*ElasticRequest) CacheKey

func (r *ElasticRequest) CacheKey() (string, error)

CacheKey returns the text of the elastic query. That text is the indentifer for the query in the cache. It is a combination of the host key, indices queries and the json query content

type Expr

type Expr struct {
	*parse.Tree
}

func New

func New(expr string, funcs ...map[string]parse.Func) (*Expr, error)

New creates a new expression tree

func (*Expr) Execute

func (e *Expr) Execute(backends *Backends, providers *BosunProviders, T miniprofiler.Timer, now time.Time, autods int, unjoinedOk 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) ExecuteState

func (e *Expr) ExecuteState(s *State, T miniprofiler.Timer) (r *Results, queries []opentsdb.Request, err error)

func (*Expr) MarshalJSON

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

type LogstashElasticHosts

type LogstashElasticHosts []string

This is an array of Logstash hosts and exists as a type for something to attach methods to. The elasticsearch library will use the listed to hosts to discover all of the hosts in the config

func (*LogstashElasticHosts) GenIndices

func (e *LogstashElasticHosts) GenIndices(r *LogstashRequest) (string, error)

GenIndicies generates the indexes to hit based on the timeframe of the query. It assumes all

func (LogstashElasticHosts) InitClient

func (e LogstashElasticHosts) InitClient() error

InitClient sets up the elastic client. If the client has already been initalized it is a noop

func (LogstashElasticHosts) Query

Query takes a Logstash request, applies it a search service, and then queries elasticsearch.

type LogstashRequest

type LogstashRequest struct {
	IndexRoot  string // The root of all index names i.e. logstash in logstash-2014-04-25
	Start      *time.Time
	End        *time.Time
	Source     *elastic.SearchSource // This the object that we build queries in
	KeyMatches []lsKeyMatch
}

LogstashRequest is a container for the information needed to query elasticsearch.

func LSBaseQuery

func LSBaseQuery(now time.Time, indexRoot string, keystring string, filter, sduration, eduration string, size int) (*LogstashRequest, error)

LSBaseQuery builds the base query that both LSCount and LSStat share

func (*LogstashRequest) CacheKey

func (r *LogstashRequest) CacheKey() string

CacheKey returns the text of the elastic query. That text is the indentifer for the query in the cache

type Number

type Number float64

func (Number) MarshalJSON

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

func (Number) Type

func (n Number) Type() models.FuncType

func (Number) Value

func (n Number) Value() interface{}

type NumberExpr

type NumberExpr Expr

func (NumberExpr) Type

func (s NumberExpr) Type() models.FuncType

func (NumberExpr) Value

func (s NumberExpr) Value() interface{}

type Result

type Result struct {
	models.Computations
	Value
	Group opentsdb.TagSet
}

type ResultSlice

type ResultSlice []*Result

func (ResultSlice) DescByValue

func (r ResultSlice) DescByValue() ResultSlice

func (ResultSlice) Filter

func (r ResultSlice) Filter(filter opentsdb.TagSet) ResultSlice

Filter returns a slice with only the results that have a tagset that conforms to the given key/value pair restrictions

type ResultSliceByGroup

type ResultSliceByGroup ResultSlice

func (ResultSliceByGroup) Len

func (r ResultSliceByGroup) Len() int

func (ResultSliceByGroup) Less

func (r ResultSliceByGroup) Less(i, j int) bool

func (ResultSliceByGroup) Swap

func (r ResultSliceByGroup) Swap(i, j int)

type ResultSliceByValue

type ResultSliceByValue ResultSlice

func (ResultSliceByValue) Len

func (r ResultSliceByValue) Len() int

func (ResultSliceByValue) Less

func (r ResultSliceByValue) Less(i, j int) bool

func (ResultSliceByValue) Swap

func (r ResultSliceByValue) Swap(i, j int)

type Results

type Results struct {
	Results ResultSlice
	// 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 AddTags

func AddTags(e *State, T miniprofiler.Timer, series *Results, s string) (*Results, error)

func AnCounts

func AnCounts(e *State, T miniprofiler.Timer, filter, startDuration, endDuration string) (r *Results, err error)

func AnDurations

func AnDurations(e *State, T miniprofiler.Timer, filter, startDuration, endDuration string) (r *Results, err error)

func AnTable

func AnTable(e *State, T miniprofiler.Timer, filter, fieldsCSV, startDuration, endDuration string) (r *Results, err error)

AnTable returns a table response (meant for Grafana) of matching annotations based on the requested fields

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 CCount

func CCount(e *State, T miniprofiler.Timer, series *Results) (*Results, 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 Crop

func Crop(e *State, T miniprofiler.Timer, sSet *Results, startSet *Results, endSet *Results) (*Results, error)

func Des

func Des(e *State, T miniprofiler.Timer, series *Results, alpha float64, beta float64) *Results

func Dev

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

func Diff

func Diff(e *State, T miniprofiler.Timer, series *Results) (r *Results, err error)

func DropBool

func DropBool(e *State, T miniprofiler.Timer, target *Results, filter *Results) (*Results, error)

func DropG

func DropG(e *State, T miniprofiler.Timer, series *Results, threshold *Results) (*Results, error)

func DropGe

func DropGe(e *State, T miniprofiler.Timer, series *Results, threshold *Results) (*Results, error)

func DropL

func DropL(e *State, T miniprofiler.Timer, series *Results, threshold *Results) (*Results, error)

func DropLe

func DropLe(e *State, T miniprofiler.Timer, series *Results, threshold *Results) (*Results, error)

func DropNA

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

func DropValues

func DropValues(e *State, T miniprofiler.Timer, series *Results, threshold *Results, dropFunction func(float64, float64) bool) (*Results, error)

func Duration

func Duration(e *State, T miniprofiler.Timer, d string) (*Results, error)

func ESAll

func ESAll(e *State, T miniprofiler.Timer) (*Results, error)

func ESAnd

func ESAnd(e *State, T miniprofiler.Timer, esqueries ...ESQuery) (*Results, error)

func ESCount

func ESCount(prefix string, e *State, T miniprofiler.Timer, indexer ESIndexer, keystring string, filter ESQuery, interval, sduration, eduration string) (r *Results, err error)

func ESDaily

func ESDaily(e *State, T miniprofiler.Timer, timeField, indexRoot, layout string) (*Results, error)

func ESDateHistogram

func ESDateHistogram(prefix string, e *State, T miniprofiler.Timer, indexer ESIndexer, keystring string, filter elastic.Query, interval, sduration, eduration, stat_field, rstat string, size int) (r *Results, err error)

func ESExists

func ESExists(e *State, T miniprofiler.Timer, field string) (*Results, error)

func ESGT

func ESGT(e *State, T miniprofiler.Timer, key string, gt float64) (*Results, error)

func ESGTE

func ESGTE(e *State, T miniprofiler.Timer, key string, gte float64) (*Results, error)

func ESIndicies

func ESIndicies(e *State, T miniprofiler.Timer, timeField string, literalIndices ...string) *Results

func ESLS

func ESLS(e *State, T miniprofiler.Timer, indexRoot string) (*Results, error)

func ESLT

func ESLT(e *State, T miniprofiler.Timer, key string, lt float64) (*Results, error)

func ESLTE

func ESLTE(e *State, T miniprofiler.Timer, key string, lte float64) (*Results, error)

func ESMonthly

func ESMonthly(e *State, T miniprofiler.Timer, timeField, indexRoot, layout string) (*Results, error)

func ESNot

func ESNot(e *State, T miniprofiler.Timer, query ESQuery) (*Results, error)

func ESOr

func ESOr(e *State, T miniprofiler.Timer, esqueries ...ESQuery) (*Results, error)

func ESQueryString

func ESQueryString(e *State, T miniprofiler.Timer, key string, query string) (*Results, error)

func ESRegexp

func ESRegexp(e *State, T miniprofiler.Timer, key string, regex string) (*Results, error)

func ESStat

func ESStat(prefix string, e *State, T miniprofiler.Timer, indexer ESIndexer, keystring string, filter ESQuery, field, rstat, interval, sduration, eduration string) (r *Results, err error)

ESStat returns a bucketed statistical reduction for the specified field.

func Epoch

func Epoch(e *State, T miniprofiler.Timer) (*Results, error)

func Filter

func Filter(e *State, T miniprofiler.Timer, series *Results, number *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 *Results) (r *Results, err error)

func GraphiteBand

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

func GraphiteQuery

func GraphiteQuery(e *State, T miniprofiler.Timer, query string, sduration, eduration, format string) (r *Results, err error)

func InfluxQuery

func InfluxQuery(e *State, T miniprofiler.Timer, db, query, startDuration, endDuration, groupByInterval string) (*Results, error)

func LSCount

func LSCount(e *State, T miniprofiler.Timer, index_root, keystring, filter, interval, sduration, eduration string) (r *Results, err error)

LScount takes 6 arguments and returns the per second for matching documents. index_root is the root name of the index to hit, the format is expected to be fmt.Sprintf("%s-%s", index_root, d.Format("2006.01.02")). keystring creates groups (like tagsets) and can also filter those groups. It is the format of "field:regex,field:regex..." The :regex can be ommited. filter is an Elastic regexp query that can be applied to any field. It is in the same format as the keystring argument. interval is in the format of an opentsdb time duration, and tells elastic what the bucket size should be. Note: The results used to be normalized to a per second rate. This is no longer done as it resulted in erroneous extrapolations. sduration and end duration are the time bounds for the query and are in opentsdb's relative time format: http://opentsdb.net/docs/build/html/user_guide/query/dates.html Caveats: 1) There is currently no escaping in the keystring, so if you regex needs to have a comma or double quote you are out of luck. 2) If the type of the field value in Elastic (aka the mapping) is a number then the regexes won't act as a regex. The only thing you can do is an exact match on the number, ie "eventlogid:1234". It is recommended that anything that is a identifer should be stored as a string since they are not numbers even if they are made up entirely of numerals.

func LSDateHistogram

func LSDateHistogram(e *State, T miniprofiler.Timer, index_root, keystring, filter, interval, sduration, eduration, stat_field, rstat string, size int) (r *Results, err error)

LSDateHistorgram builds the aggregation query using subaggregations. The result is a grouped time series that Bosun can understand

func LSStat

func LSStat(e *State, T miniprofiler.Timer, index_root, keystring, filter, field, rstat, interval, sduration, eduration string) (r *Results, err error)

LSStat returns a bucketed statistical reduction for the specified field. The arguments are the same LSCount with the addition of the following: The field is the field to generate stats for - this must be a number type in elastic. rstat is the reduction function to use per bucket and can be one of the following: avg, min, max, sum, sum_of_squares, variance, std_deviation

func Last

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

func LeftJoin

func LeftJoin(e *State, T miniprofiler.Timer, keysCSV, columnsCSV string, rowData ...*Results) (*Results, error)

func Length

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

func Limit

func Limit(e *State, T miniprofiler.Timer, series *Results, v float64) (*Results, error)

func Line_lr

func Line_lr(e *State, T miniprofiler.Timer, series *Results, d string) (*Results, error)

func Map

func Map(e *State, T miniprofiler.Timer, series *Results, expr *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 Merge

func Merge(e *State, T miniprofiler.Timer, series ...*Results) (*Results, error)

func Min

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

func Month

func Month(e *State, T miniprofiler.Timer, offset float64, startEnd string) (*Results, error)

func NV

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

func Over

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

func Percentile

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

func Query

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

func Remove

func Remove(e *State, T miniprofiler.Timer, seriesSet *Results, tagKey string) (*Results, error)

func Rename

func Rename(e *State, T miniprofiler.Timer, series *Results, s string) (*Results, error)

func SeriesFunc

func SeriesFunc(e *State, T miniprofiler.Timer, tags string, pairs ...float64) (*Results, error)

func Shift

func Shift(e *State, T miniprofiler.Timer, series *Results, d string) (*Results, error)

func ShiftBand

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

func Since

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

func Sort

func Sort(e *State, T miniprofiler.Timer, series *Results, order string) (*Results, error)

func Streak

func Streak(e *State, T miniprofiler.Timer, series *Results) (*Results, error)

func Sum

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

func Tail

func Tail(e *State, T miniprofiler.Timer, series *Results, number *Results) (*Results, error)

func TimeDelta

func TimeDelta(e *State, T miniprofiler.Timer, series *Results) (*Results, error)

func ToDuration

func ToDuration(e *State, T miniprofiler.Timer, sec float64) (*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 V

func V(e *State, T miniprofiler.Timer) (*Results, error)

func Window

func Window(e *State, T miniprofiler.Timer, query, duration, period string, num float64, rfunc string) (*Results, error)

func (*Results) Equal

func (a *Results) Equal(b *Results) (bool, error)

Equal inspects if two results have the same content error will return why they are not equal if they are not equal

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() models.FuncType

func (Scalar) Value

func (s Scalar) Value() interface{}

type Series

type Series map[time.Time]float64

Series is the standard form within bosun to represent timeseries data.

func (Series) Equal

func (a Series) Equal(b Series) bool

func (Series) MarshalJSON

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

func (Series) Type

func (s Series) Type() models.FuncType

func (Series) Value

func (s Series) Value() interface{}

type SortablePoint

type SortablePoint struct {
	T time.Time
	V float64
}

type SortableSeries

type SortableSeries []SortablePoint

SortableSeries is an alternative datastructure for timeseries data, which stores points in a time-ordered fashion instead of a map. see discussion at https://github.com/bosun-monitor/bosun/pull/699

func NewSortedSeries

func NewSortedSeries(dps Series) SortableSeries

func (SortableSeries) Len

func (s SortableSeries) Len() int

func (SortableSeries) Less

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

func (SortableSeries) Swap

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

type State

type State struct {
	*Expr

	*Backends

	// Bosun Internal
	*BosunProviders
	// contains filtered or unexported fields
}

func (*State) AddComputation

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

type String

type String string

func (String) Type

func (s String) Type() models.FuncType

func (String) Value

func (s String) Value() interface{}

type Table

type Table struct {
	Columns []string
	Rows    [][]interface{}
}

func (Table) Type

func (t Table) Type() models.FuncType

func (Table) Value

func (t Table) Value() interface{}

type Union

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

func (*Union) ExtendComputations

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

type Value

type Value interface {
	Type() models.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