promql

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 21 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LabelMatchersToModelMatcher added in v0.5.0

func LabelMatchersToModelMatcher(
	lMatchers []*labels.Matcher,
	tagOpts models.TagOptions,
) (models.Matchers, error)

LabelMatchersToModelMatcher parses promql matchers to model matchers.

func NewAggregationOperator added in v0.4.2

func NewAggregationOperator(expr *promql.AggregateExpr) (parser.Params, error)

NewAggregationOperator creates a new aggregation operator based on the type.

func NewBinaryOperator

func NewBinaryOperator(expr *promql.BinaryExpr,
	lhs, rhs parser.NodeID) (parser.Params, error)

NewBinaryOperator creates a new binary operator based on the type.

func NewFunctionExpr

func NewFunctionExpr(
	name string,
	argValues []interface{},
	stringValues []string,
	hasArgValue bool,
	inner string,
	tagOptions models.TagOptions,
) (parser.Params, bool, error)

NewFunctionExpr creates a new function expr based on the type.

func NewSelectorFromMatrix

func NewSelectorFromMatrix(
	n *promql.MatrixSelector,
	tagOpts models.TagOptions,
) (parser.Params, error)

NewSelectorFromMatrix creates a new fetchop.

func NewSelectorFromVector

func NewSelectorFromVector(
	n *promql.VectorSelector,
	tagOpts models.TagOptions,
) (parser.Params, error)

NewSelectorFromVector creates a new fetchop.

func Parse

func Parse(
	q string,
	stepSize time.Duration,
	tagOpts models.TagOptions,
	parseOptions ParseOptions,
) (parser.Parser, error)

Parse takes a promQL string and converts parses it into a DAG.

Types

type MetricSelectorFn added in v0.15.7

type MetricSelectorFn func(query string) ([]*labels.Matcher, error)

MetricSelectorFn is a function that parses a query to Prometheus selectors.

type ParseFn added in v0.15.0

type ParseFn func(query string) (pql.Expr, error)

ParseFn is a function that parses a query to a Prometheus expression.

type ParseFunctionExpr added in v0.15.0

type ParseFunctionExpr func(
	name string,
	argValues []interface{},
	stringValues []string,
	hasArgValue bool,
	inner string,
	tagOptions models.TagOptions,
) (parser.Params, bool, error)

ParseFunctionExpr parses arguments to a function expression, returning a function, a bool indicating whether the function is a noop, and any errors during execution.

type ParseOptions added in v0.15.0

type ParseOptions interface {
	// ParseFn gets the parse function.
	ParseFn() ParseFn
	// SetParseFn sets the parse function.
	SetParseFn(ParseFn) ParseOptions

	// MetricSelectorFn gets the metric selector function.
	MetricSelectorFn() MetricSelectorFn
	// SetMetricSelectorFn sets the metric selector function.
	SetMetricSelectorFn(MetricSelectorFn) ParseOptions

	// FunctionParseExpr gets the parsing function.
	FunctionParseExpr() ParseFunctionExpr
	// SetFunctionParseExpr sets the parsing function.
	SetFunctionParseExpr(ParseFunctionExpr) ParseOptions

	// NowFn gets the now function.
	NowFn() xclock.NowFn
	// SetNowFn sets the now function.
	SetNowFn(xclock.NowFn) ParseOptions

	// RequireStartEndTime returns whether requests require a start and end time.
	RequireStartEndTime() bool
	// SetRequireStartEndTime sets whether requests require a start and end time.
	SetRequireStartEndTime(bool) ParseOptions
}

ParseOptions are options for the Prometheus parser.

func NewParseOptions added in v0.15.0

func NewParseOptions() ParseOptions

NewParseOptions creates a new parse options.

Jump to

Keyboard shortcuts

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