promql

package
v1.21.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryArithmeticOperators

type BinaryArithmeticOperators string

二元算术运算符

const (
	Addition       BinaryArithmeticOperators = "+"
	Subtraction    BinaryArithmeticOperators = "-"
	Multiplication BinaryArithmeticOperators = "*"
	Division       BinaryArithmeticOperators = "/"
	Modulo         BinaryArithmeticOperators = "%"
	Power          BinaryArithmeticOperators = "^"
)

type ComparisonOperator

type ComparisonOperator string

比较运算符

const (
	Equal          ComparisonOperator = "=="
	NotEqual       ComparisonOperator = "!="
	GreaterThan    ComparisonOperator = ">"
	LessThan       ComparisonOperator = "<"
	GreaterOrEqual ComparisonOperator = ">="
	LessOrEqual    ComparisonOperator = "<="
)

type LabelOperator

type LabelOperator string

ref. https://prometheus.io/docs/prometheus/latest/querying/basics/#time-series-selectors

const (
	LabelEqual    LabelOperator = "="
	LabelNotEqual LabelOperator = "!="
	LabelRegex    LabelOperator = "=~"
	LabelNotRegex LabelOperator = "!~"
)

type Query

type Query struct {
	// contains filtered or unexported fields
}

func New

func New(metric string) *Query

func (*Query) AddSelector

func (q *Query) AddSelector(key string, op LabelOperator, value string) *Query

func (*Query) Arithmetic

func (q *Query) Arithmetic(op BinaryArithmeticOperators, value string) *Query

func (*Query) Compare

func (q *Query) Compare(compare ComparisonOperator, value string) *Query

func (*Query) Round

func (q *Query) Round(round float64) *Query

func (*Query) SumBy

func (q *Query) SumBy(labels ...string) *Query

func (*Query) ToPromql

func (q *Query) ToPromql() string

func (*Query) Topk

func (q *Query) Topk(topk int) *Query

Jump to

Keyboard shortcuts

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