bosun.org: bosun.org/cmd/bosun/expr Index | Files | Directories

package expr

import "bosun.org/cmd/bosun/expr"

Index

Package Files

annotate.go azure.go azureai.go cloudwatch.go elastic.go elastic2.go elastic5.go elastic6.go elastic7.go elastic_all.go expr.go funcs.go graphite.go influx.go prom.go tsdb.go

Variables

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,
    },
}
var AzureMonitor = map[string]parse.Func{
    "az": {
        Args:          []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeString, models.TypeString, models.TypeString, models.TypeString, models.TypeString, models.TypeString},
        Return:        models.TypeSeriesSet,
        Tags:          azTags,
        F:             AzureQuery,
        PrefixEnabled: true,
    },
    "azmulti": {
        Args:          []models.FuncType{models.TypeString, models.TypeString, models.TypeAzureResourceList, models.TypeString, models.TypeString, models.TypeString, models.TypeString},
        Return:        models.TypeSeriesSet,
        Tags:          azMultiTags,
        F:             AzureMultiQuery,
        PrefixEnabled: true,
    },
    "azmd": {
        Args:          []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeString},
        Return:        models.TypeSeriesSet,
        Tags:          tagFirst,
        F:             AzureMetricDefinitions,
        PrefixEnabled: true,
    },
    "azrt": {
        Args:          []models.FuncType{models.TypeString},
        Return:        models.TypeAzureResourceList,
        F:             AzureResourcesByType,
        PrefixEnabled: true,
    },
    "azrf": {
        Args:   []models.FuncType{models.TypeAzureResourceList, models.TypeString},
        Return: models.TypeAzureResourceList,
        F:      AzureFilterResources,
    },

    "aiapp": {
        Args:          []models.FuncType{},
        Return:        models.TypeAzureAIApps,
        F:             AzureAIListApps,
        PrefixEnabled: true,
    },
    "aiappf": {
        Args:          []models.FuncType{models.TypeAzureAIApps, models.TypeString},
        Return:        models.TypeAzureAIApps,
        F:             AzureAIFilterApps,
        PrefixEnabled: true,
    },
    "aimd": {
        Args:          []models.FuncType{models.TypeAzureAIApps},
        Return:        models.TypeInfo,
        F:             AzureAIMetricMD,
        PrefixEnabled: true,
    },
    "ai": {
        Args:          []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeAzureAIApps, models.TypeString, models.TypeString, models.TypeString, models.TypeString},
        Return:        models.TypeSeriesSet,
        Tags:          azAITags,
        F:             AzureAIQuery,
        PrefixEnabled: true,
    },
}

AzureMonitor is the collection of functions for the Azure monitor datasource

var CloudWatch = map[string]parse.Func{

    "cw": {
        Args: []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeString,
            models.TypeString, models.TypeString, models.TypeString, models.TypeString},
        Return:        models.TypeSeriesSet,
        Tags:          cloudwatchTagQuery,
        F:             CloudWatchQuery,
        PrefixEnabled: true,
    },
}

cloudwatch defines functions for use with amazon cloudwatch api

var DimensionParseError = errors.New("dimensions must be in format key:value")
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

var EndParseError = errors.New("Could not parse the end value")
var ErrUnknownOp = fmt.Errorf("expr: unknown op type")
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.

var Influx = map[string]parse.Func{
    "influx": {
        Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeString, models.TypeString},
        Return: models.TypeSeriesSet,
        Tags:   influxTag,
        F:      InfluxQuery,
    },
}

Influx is a map of functions to query InfluxDB.

var PeriodParseError = errors.New("Could not parse the period value")
var Prom = map[string]parse.Func{
    "prom": {
        Args: []models.FuncType{
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
        },
        Return:        models.TypeSeriesSet,
        Tags:          promGroupTags,
        F:             PromQuery,
        PrefixEnabled: true,
    },
    "promm": {
        Args: []models.FuncType{
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
        },
        Return:        models.TypeSeriesSet,
        Tags:          promMGroupTags,
        F:             PromMQuery,
        PrefixEnabled: true,
    },
    "promrate": {
        Args: []models.FuncType{
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
        },
        Return:        models.TypeSeriesSet,
        Tags:          promGroupTags,
        F:             PromRate,
        PrefixEnabled: true,
    },
    "promratem": {
        Args: []models.FuncType{
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
        },
        Return:        models.TypeSeriesSet,
        Tags:          promMGroupTags,
        F:             PromMRate,
        PrefixEnabled: true,
    },
    "promras": {
        Args: []models.FuncType{
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
        },
        Return:        models.TypeSeriesSet,
        Tags:          promAggRawTags,
        F:             PromRawAggSeriesQuery,
        PrefixEnabled: true,
    },
    "prommras": {
        Args: []models.FuncType{
            models.TypeString,
            models.TypeString,
            models.TypeString,
            models.TypeString,
        },
        Return:        models.TypeSeriesSet,
        Tags:          promMAggRawTags,
        F:             PromMRawAggSeriesQuery,
        PrefixEnabled: true,
    },
    "prommetrics": {
        Args:          []models.FuncType{},
        Return:        models.TypeInfo,
        F:             PromMetricList,
        PrefixEnabled: true,
    },
    "promtags": {
        Args: []models.FuncType{
            models.TypeString,
            models.TypeString,
            models.TypeString,
        },
        Return:        models.TypeInfo,
        F:             PromTagInfo,
        PrefixEnabled: true,
    },
}

Prom is a map of functions to query Prometheus.

var StartParseError = errors.New("Could not parse the start value")
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,
    },
    "bandQuery": {
        Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeString, models.TypeScalar},
        Return: models.TypeSeriesSet,
        Tags:   tagQuery,
        F:      BandQuery,
    },
    "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,
    },
    "overQuery": {
        Args:   []models.FuncType{models.TypeString, models.TypeString, models.TypeString, models.TypeString, models.TypeScalar},
        Return: models.TypeSeriesSet,
        Tags:   tagQuery,
        F:      OverQuery,
    },
    "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.

func ScopeES2 Uses

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

func ScopeES5 Uses

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

func ScopeES6 Uses

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

func ScopeES7 Uses

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

type AlertStatusProvider Uses

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 AzureApplicationInsightsApp Uses

type AzureApplicationInsightsApp struct {
    ApplicationName string
    AppId           string
    Tags            map[string]string
}

AzureApplicationInsightsApp in collection of properties for each Azure Application Insights Resource

func (AzureApplicationInsightsApp) Ask Uses

func (app AzureApplicationInsightsApp) Ask(filter string) (bool, error)

Ask makes an AzureApplicationInsightsApp a github.com/kylebrandt/boolq Asker, which allows it to to take boolean expressions to create true/false conditions for filtering

type AzureApplicationInsightsApps Uses

type AzureApplicationInsightsApps struct {
    Applications []AzureApplicationInsightsApp
    Prefix       string
}

AzureApplicationInsightsApps is a container for a list of AzureApplicationInsightsApp objects It is a bosun type since it passed to Azure Insights query functions

func (AzureApplicationInsightsApps) Type Uses

func (a AzureApplicationInsightsApps) Type() models.FuncType

func (AzureApplicationInsightsApps) Value Uses

func (a AzureApplicationInsightsApps) Value() interface{}

type AzureMonitorClientCollection Uses

type AzureMonitorClientCollection struct {
    MetricsClient           insights.MetricsClient
    MetricDefinitionsClient insights.MetricDefinitionsClient
    ResourcesClient         resources.Client
    AIComponentsClient      ainsightsmgmt.ComponentsClient
    AIMetricsClient         ainsights.MetricsClient
    Concurrency             int
    TenantId                string
}

AzureMonitorClientCollection is a collection of Azure SDK clients since the SDK provides different clients to access different sorts of resources

type AzureMonitorClients Uses

type AzureMonitorClients map[string]AzureMonitorClientCollection

AzureMonitorClients is map of all the AzureMonitorClientCollections that have been configured. This is so multiple subscription/tenant/clients can be queries from the same Bosun instance using the prefix syntax

type AzureResource Uses

type AzureResource struct {
    Name          string
    Type          string
    ResourceGroup string
    Tags          map[string]string
    ID            string
}

AzureResource is a container for Azure resource information that Bosun can interact with

func (AzureResource) Ask Uses

func (ar AzureResource) Ask(filter string) (bool, error)

Ask makes an AzureResource a github.com/kylebrandt/boolq Asker, which allows it to take boolean expressions to create true/false conditions for filtering

type AzureResources Uses

type AzureResources struct {
    Resources []AzureResource
    Prefix    string
}

AzureResources is a slice of AzureResource type AzureResources []AzureResource

func (AzureResources) Get Uses

func (resources AzureResources) Get(rType, rsg, name string) (az AzureResource, found bool)

Get Returns an AzureResource from AzureResources based on the resource type, group, and name If no matching resource is found, an AzureResource object will be returned but found will be false.

func (AzureResources) Type Uses

func (a AzureResources) Type() models.FuncType

func (AzureResources) Value Uses

func (a AzureResources) Value() interface{}

type Backends Uses

type Backends struct {
    TSDBContext       opentsdb.Context
    GraphiteContext   graphite.Context
    ElasticHosts      ElasticHosts
    InfluxConfig      client.HTTPConfig
    ElasticConfig     ElasticConfig
    AzureMonitor      AzureMonitorClients
    CloudWatchContext cloudwatch.Context
    PromConfig        PromClients
}

type BosunProviders Uses

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

type ESIndexer Uses

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

func (ESIndexer) MarshalJSON Uses

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

func (ESIndexer) Type Uses

func (e ESIndexer) Type() models.FuncType

func (ESIndexer) Value Uses

func (e ESIndexer) Value() interface{}

type ESQuery Uses

type ESQuery struct {
    Query func(ver ESVersion) interface{}
}

func (ESQuery) MarshalJSON Uses

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

func (ESQuery) Type Uses

func (e ESQuery) Type() models.FuncType

func (ESQuery) Value Uses

func (e ESQuery) Value() interface{}

type ESVersion Uses

type ESVersion string
const (
    ESV2 ESVersion = "v2"
    ESV5 ESVersion = "v5"
    ESV6 ESVersion = "v6"
    ESV7 ESVersion = "v7"
)

type ElasticConfig Uses

type ElasticConfig struct {
    Hosts             []string
    Version           ESVersion
    SimpleClient      bool
    ClientOptionFuncs interface{}
}

type ElasticHosts Uses

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 Uses

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) InitClient2 Uses

func (e ElasticHosts) InitClient2(prefix string) error

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

func (ElasticHosts) InitClient5 Uses

func (e ElasticHosts) InitClient5(prefix string) error

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

func (ElasticHosts) InitClient6 Uses

func (e ElasticHosts) InitClient6(prefix string) error

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

func (ElasticHosts) InitClient7 Uses

func (e ElasticHosts) InitClient7(prefix string) error

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

func (ElasticHosts) Query2 Uses

func (e ElasticHosts) Query2(r *ElasticRequest2) (*elastic.SearchResult, error)

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

func (ElasticHosts) Query5 Uses

func (e ElasticHosts) Query5(r *ElasticRequest5) (*elastic.SearchResult, error)

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

func (ElasticHosts) Query6 Uses

func (e ElasticHosts) Query6(r *ElasticRequest6) (*elastic.SearchResult, error)

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

func (ElasticHosts) Query7 Uses

func (e ElasticHosts) Query7(r *ElasticRequest7) (*elastic.SearchResult, error)

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

type ElasticRequest2 Uses

type ElasticRequest2 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 ESBaseQuery2 Uses

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

ESBaseQuery builds the base query that both ESCount and ESStat share

func (*ElasticRequest2) CacheKey Uses

func (r *ElasticRequest2) 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 ElasticRequest5 Uses

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

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

func ESBaseQuery5 Uses

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

ESBaseQuery builds the base query that both ESCount and ESStat share

func (*ElasticRequest5) CacheKey Uses

func (r *ElasticRequest5) 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 ElasticRequest6 Uses

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

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

func ESBaseQuery6 Uses

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

ESBaseQuery builds the base query that both ESCount and ESStat share

func (*ElasticRequest6) CacheKey Uses

func (r *ElasticRequest6) 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 ElasticRequest7 Uses

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

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

func ESBaseQuery7 Uses

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

ESBaseQuery builds the base query that both ESCount and ESStat share

func (*ElasticRequest7) CacheKey Uses

func (r *ElasticRequest7) 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 Uses

type Expr struct {
    *parse.Tree
}

func New Uses

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

New creates a new expression tree

func (*Expr) Execute Uses

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

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

func (*Expr) MarshalJSON Uses

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

type Info Uses

type Info []interface{}

func (Info) Type Uses

func (i Info) Type() models.FuncType

func (Info) Value Uses

func (i Info) Value() interface{}

type Number Uses

type Number float64

func (Number) MarshalJSON Uses

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

func (Number) Type Uses

func (n Number) Type() models.FuncType

func (Number) Value Uses

func (n Number) Value() interface{}

type NumberExpr Uses

type NumberExpr Expr

func (NumberExpr) Type Uses

func (s NumberExpr) Type() models.FuncType

func (NumberExpr) Value Uses

func (s NumberExpr) Value() interface{}

type PromClients Uses

type PromClients map[string]promv1.API

PromClients is a collection of Prometheus API v1 client APIs (connections)

type Result Uses

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

type ResultSlice Uses

type ResultSlice []*Result

func (ResultSlice) DescByValue Uses

func (r ResultSlice) DescByValue() ResultSlice

func (ResultSlice) Filter Uses

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 Uses

type ResultSliceByGroup ResultSlice

func (ResultSliceByGroup) Len Uses

func (r ResultSliceByGroup) Len() int

func (ResultSliceByGroup) Less Uses

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

func (ResultSliceByGroup) Swap Uses

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

type ResultSliceByValue Uses

type ResultSliceByValue ResultSlice

func (ResultSliceByValue) Len Uses

func (r ResultSliceByValue) Len() int

func (ResultSliceByValue) Less Uses

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

func (ResultSliceByValue) Swap Uses

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

type Results Uses

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 Uses

func Abs(e *State, set *Results) *Results

func AddTags Uses

func AddTags(e *State, set *Results, s string) (*Results, error)

func Aggr Uses

func Aggr(e *State, series *Results, groups string, aggregator string) (*Results, error)

Aggr combines multiple series matching the specified groups using an aggregator function. If group is empty, all given series are combined, regardless of existing groups. Available aggregator functions include: avg, min, max, sum, and pN, where N is a float between 0 and 1 inclusive, e.g. p.50 represents the 50th percentile. p0 and p1 are equal to min and max, respectively, but min and max are preferred for readability.

func AnCounts Uses

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

func AnDurations Uses

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

func AnTable Uses

func AnTable(e *State, 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 Uses

func Avg(e *State, series *Results) (*Results, error)

func AzureAIFilterApps Uses

func AzureAIFilterApps(prefix string, e *State, apps AzureApplicationInsightsApps, filter string) (r *Results, err error)

AzureAIFilterApps filters a list of applications based on the name of the app, or the Azure tags associated with the application resource

func AzureAIListApps Uses

func AzureAIListApps(prefix string, e *State) (r *Results, err error)

AzureAIListApps get a list of all applications on the subscription and returns those apps in a AzureApplicationInsightsApps within the result

func AzureAIMetricMD Uses

func AzureAIMetricMD(prefix string, e *State, apps AzureApplicationInsightsApps) (r *Results, err error)

AzureAIMetricMD returns metric metadata for the listed AzureApplicationInsightsApps. This is not meant as core expression function, but rather one for interactive inspection through the expression UI.

func AzureAIQuery Uses

func AzureAIQuery(prefix string, e *State, metric, segmentCSV, filter string, apps AzureApplicationInsightsApps, agtype, interval, sdur, edur string) (r *Results, err error)

AzureAIQuery queries the Azure Application Insights API for metrics data and transforms the response into a series set

func AzureFilterResources Uses

func AzureFilterResources(e *State, resources AzureResources, filter string) (r *Results, err error)

AzureFilterResources filters a list of resources based on the value of the name, resource group or tags associated with that resource

func AzureMetricDefinitions Uses

func AzureMetricDefinitions(prefix string, e *State, namespace, metric, rsg, resource string) (r *Results, err error)

AzureMetricDefinitions fetches metric information for a specific resource and metric tuple TODO make this return and not fmt.Printf

func AzureMultiQuery Uses

func AzureMultiQuery(prefix string, e *State, metric, tagKeysCSV string, resources AzureResources, agtype string, interval, sdur, edur string) (r *Results, err error)

AzureMultiQuery queries multiple Azure resources and returns them as a single result set It makes one HTTP request per resource and parallelizes the requests

func AzureQuery Uses

func AzureQuery(prefix string, e *State, namespace, metric, tagKeysCSV, rsg, resName, agtype, interval, sdur, edur string) (r *Results, err error)

AzureQuery queries an Azure monitor metric for the given resource and returns a series set tagged by rsg (resource group), name (resource name), and any tag keys parsed from the tagKeysCSV argument

func AzureResourcesByType Uses

func AzureResourcesByType(prefix string, e *State, tp string) (r *Results, err error)

AzureResourcesByType returns all resources of the specified type It fetches the complete list resources and then filters them relying on a Cache of that resource list

func Band Uses

func Band(e *State, query, duration, period string, num float64) (r *Results, err error)

func BandQuery Uses

func BandQuery(e *State, query, duration, period, eduration string, num float64) (r *Results, err error)

func CCount Uses

func CCount(e *State, series *Results) (*Results, error)

func Change Uses

func Change(e *State, query, sduration, eduration string) (r *Results, err error)

func CloudWatchQuery Uses

func CloudWatchQuery(prefix string, e *State, region, namespace, metric, period, statistic, dimensions, sduration, eduration string) (*Results, error)

func Count Uses

func Count(e *State, query, sduration, eduration string) (r *Results, err error)

func Crop Uses

func Crop(e *State, sSet *Results, startSet *Results, endSet *Results) (*Results, error)

func Des Uses

func Des(e *State, series *Results, alpha float64, beta float64) *Results

func Dev Uses

func Dev(e *State, series *Results) (*Results, error)

func Diff Uses

func Diff(e *State, series *Results) (r *Results, err error)

func DropBool Uses

func DropBool(e *State, target *Results, filter *Results) (*Results, error)

func DropG Uses

func DropG(e *State, series *Results, threshold *Results) (*Results, error)

func DropGe Uses

func DropGe(e *State, series *Results, threshold *Results) (*Results, error)

func DropL Uses

func DropL(e *State, series *Results, threshold *Results) (*Results, error)

func DropLe Uses

func DropLe(e *State, series *Results, threshold *Results) (*Results, error)

func DropNA Uses

func DropNA(e *State, series *Results) (*Results, error)

func DropValues Uses

func DropValues(e *State, series *Results, threshold *Results, dropFunction func(float64, float64) bool) (*Results, error)

func Duration Uses

func Duration(e *State, d string) (*Results, error)

func ESAll Uses

func ESAll(e *State) (*Results, error)

func ESAnd Uses

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

func ESCount Uses

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

func ESDaily Uses

func ESDaily(e *State, timeField, indexRoot, layout string) (*Results, error)

func ESDateHistogram2 Uses

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

func ESDateHistogram5 Uses

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

func ESDateHistogram6 Uses

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

func ESDateHistogram7 Uses

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

func ESExists Uses

func ESExists(e *State, field string) (*Results, error)

func ESGT Uses

func ESGT(e *State, key string, gt float64) (*Results, error)

func ESGTE Uses

func ESGTE(e *State, key string, gte float64) (*Results, error)

func ESIndicies Uses

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

func ESLS Uses

func ESLS(e *State, indexRoot string) (*Results, error)

func ESLT Uses

func ESLT(e *State, key string, lt float64) (*Results, error)

func ESLTE Uses

func ESLTE(e *State, key string, lte float64) (*Results, error)

func ESMonthly Uses

func ESMonthly(e *State, timeField, indexRoot, layout string) (*Results, error)

func ESNot Uses

func ESNot(e *State, query ESQuery) (*Results, error)

func ESOr Uses

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

func ESQueryString Uses

func ESQueryString(e *State, key string, query string) (*Results, error)

func ESRegexp Uses

func ESRegexp(e *State, key string, regex string) (*Results, error)

func ESStat Uses

func ESStat(prefix string, e *State, 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 Uses

func Epoch(e *State) (*Results, error)

func Filter Uses

func Filter(e *State, set *Results, numberSet *Results) (*Results, error)

func First Uses

func First(e *State, series *Results) (*Results, error)

func Forecast_lr Uses

func Forecast_lr(e *State, series *Results, y *Results) (r *Results, err error)

func GraphiteBand Uses

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

func GraphiteQuery Uses

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

func InfluxQuery Uses

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

func IsNaN Uses

func IsNaN(e *State, nSet *Results) (*Results, error)

func Last Uses

func Last(e *State, series *Results) (*Results, error)

func LeftJoin Uses

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

func Length Uses

func Length(e *State, series *Results) (*Results, error)

func Limit Uses

func Limit(e *State, set *Results, v float64) (*Results, error)

func Line_lr Uses

func Line_lr(e *State, series *Results, d string) (*Results, error)

func Map Uses

func Map(e *State, series *Results, expr *Results) (*Results, error)

func Max Uses

func Max(e *State, series *Results) (r *Results, err error)

func Median Uses

func Median(e *State, series *Results) (r *Results, err error)

func Merge Uses

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

func Min Uses

func Min(e *State, series *Results) (r *Results, err error)

func Month Uses

func Month(e *State, offset float64, startEnd string) (*Results, error)

func NV Uses

func NV(e *State, series *Results, v float64) (results *Results, err error)

func Over Uses

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

func OverQuery Uses

func OverQuery(e *State, query, duration, period, eduration string, num float64) (r *Results, err error)

func Percentile Uses

func Percentile(e *State, series *Results, p *Results) (r *Results, err error)

func PromMQuery Uses

func PromMQuery(prefix string, e *State, metric, groupBy, filter, agType, stepDuration, sdur, edur string) (r *Results, err error)

PromMQuery is a wrapper from promMQuery in the way that PromQuery is a wrapper from promQuery.

func PromMRate Uses

func PromMRate(prefix string, e *State, metric, groupBy, filter, agType, rateDuration, stepDuration, sdur, edur string) (r *Results, err error)

PromMRate is a wrapper from promMQuery in the way that PromRate is a wrapper from promQuery. It has a stepDuration argument for rate calculation.

func PromMRawAggSeriesQuery Uses

func PromMRawAggSeriesQuery(prefix string, e *State, query, stepDuration, sdur, edur string) (*Results, error)

PromMRawAggSeriesQuery is wrapper for promRawAggSeriesQuery setting the multi argument to true.

func PromMetricList Uses

func PromMetricList(prefix string, e *State) (r *Results, err error)

PromMetricList returns a list of available metrics for the prometheus backend by using querying the Prometheus Label Values API for "__name__"

func PromQuery Uses

func PromQuery(prefix string, e *State, metric, groupBy, filter, agType, stepDuration, sdur, edur string) (r *Results, err error)

PromQuery is a wrapper for promQuery so there is a function signature that doesn't require the rate argument in the expr language. It also sets promQuery's addPrefixTag argument to false since this only queries one backend.

func PromRate Uses

func PromRate(prefix string, e *State, metric, groupBy, filter, agType, rateDuration, stepDuration, sdur, edur string) (r *Results, err error)

PromRate is a wrapper for promQuery like PromQuery except that it has a rateDuration argument for the step of the rate calculation. This enables rate calculation for counters.

func PromRawAggSeriesQuery Uses

func PromRawAggSeriesQuery(prefix string, e *State, query, stepDuration, sdur, edur string) (*Results, error)

PromRawAggSeriesQuery is wrapper for promRawAggSeriesQuery setting the multi argument to false.

func PromTagInfo Uses

func PromTagInfo(prefix string, e *State, metric, sdur, edur string) (r *Results, err error)

PromTagInfo does a range query for the given metric and returns info about the tags and labels for the metric based on the data from the queried timeframe

func Query Uses

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

func Remove Uses

func Remove(e *State, set *Results, tagKey string) (*Results, error)

func Rename Uses

func Rename(e *State, set *Results, s string) (*Results, error)

func SeriesFunc Uses

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

func Shift Uses

func Shift(e *State, series *Results, d string) (*Results, error)

func ShiftBand Uses

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

func Since Uses

func Since(e *State, series *Results) (*Results, error)

func Sort Uses

func Sort(e *State, series *Results, order string) (*Results, error)

func Streak Uses

func Streak(e *State, series *Results) (*Results, error)

func Sum Uses

func Sum(e *State, series *Results) (*Results, error)

func Tail Uses

func Tail(e *State, series *Results, number *Results) (*Results, error)

func TimeDelta Uses

func TimeDelta(e *State, series *Results) (*Results, error)

func ToDuration Uses

func ToDuration(e *State, sec float64) (*Results, error)

func Transpose Uses

func Transpose(e *State, d *Results, gp string) (*Results, error)

func Ungroup Uses

func Ungroup(e *State, d *Results) (*Results, error)

func V Uses

func V(e *State) (*Results, error)

func Window Uses

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

func (*Results) Equal Uses

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 Uses

func (r *Results) NaN() Number

type Scalar Uses

type Scalar float64

func (Scalar) MarshalJSON Uses

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

func (Scalar) Type Uses

func (s Scalar) Type() models.FuncType

func (Scalar) Value Uses

func (s Scalar) Value() interface{}

type Series Uses

type Series map[time.Time]float64

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

func (Series) Equal Uses

func (a Series) Equal(b Series) bool

func (Series) MarshalJSON Uses

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

func (Series) Type Uses

func (s Series) Type() models.FuncType

func (Series) Value Uses

func (s Series) Value() interface{}

type SortablePoint Uses

type SortablePoint struct {
    T   time.Time
    V   float64
}

type SortableSeries Uses

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 Uses

func NewSortedSeries(dps Series) SortableSeries

func (SortableSeries) Len Uses

func (s SortableSeries) Len() int

func (SortableSeries) Less Uses

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

func (SortableSeries) Swap Uses

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

type State Uses

type State struct {
    *Expr

    // Origin allows the source of the expression to be identified for logging and debugging
    Origin string

    Timer miniprofiler.Timer

    *Backends

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

func (*State) AddComputation Uses

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

type String Uses

type String string

func (String) Type Uses

func (s String) Type() models.FuncType

func (String) Value Uses

func (s String) Value() interface{}

type Table Uses

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

func (Table) Type Uses

func (t Table) Type() models.FuncType

func (Table) Value Uses

func (t Table) Value() interface{}

type Union Uses

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

func (*Union) ExtendComputations Uses

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

type Value Uses

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

Directories

PathSynopsis
parsePackage parse builds parse trees for expressions as defined by expr.

Package expr imports 47 packages (graph) and is imported by 8 packages. Updated 2020-06-30. Refresh now. Tools for package owners.