conditions

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FrameToSeriesSlice

func FrameToSeriesSlice(frame *data.Frame) (legacydata.DataTimeSeriesSlice, error)

FrameToSeriesSlice converts a frame that is a valid time series as per data.TimeSeriesSchema() to a DataTimeSeriesSlice.

func HumanThresholdType

func HumanThresholdType(typ string) string

HumanThresholdType converts a threshold "type" string to a string that matches the UI so errors are less confusing.

Types

type AlertEvaluator

type AlertEvaluator interface {
	Eval(reducedValue null.Float) bool
}

AlertEvaluator evaluates the reduced value of a timeseries. Returning true if a timeseries is violating the condition ex: ThresholdEvaluator, NoValueEvaluator, RangeEvaluator

func NewAlertEvaluator

func NewAlertEvaluator(model *simplejson.Json) (AlertEvaluator, error)

NewAlertEvaluator is a factory function for returning an `AlertEvaluator` depending on the json model.

type AlertQuery

type AlertQuery struct {
	Model        *simplejson.Json
	DatasourceID int64
	From         string
	To           string
}

AlertQuery contains information about what datasource a query should be sent to and the query object.

type QueryCondition

type QueryCondition struct {
	Index     int
	Query     AlertQuery
	Reducer   *queryReducer
	Evaluator AlertEvaluator
	Operator  string
}

QueryCondition is responsible for issue and query, reduce the timeseries into single values and evaluate if they are firing or not.

func (*QueryCondition) Eval

Eval evaluates the `QueryCondition`.

Jump to

Keyboard shortcuts

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