Documentation ¶
Index ¶
- Constants
- Variables
- func DocumentedType(t ValueType) string
- func ExtractSelectors(expr Expr) [][]*labels.Matcher
- func Inspect(node Node, f inspector)
- func MustLabelMatcher(mt labels.MatchType, name, val string) *labels.Matcher
- func ParseMetric(input string) (m labels.Labels, err error)
- func ParseMetricSelector(input string) (m []*labels.Matcher, err error)
- func Prettify(n Node) string
- func Tree(node Node) string
- func Walk(v Visitor, node Node, path []Node) error
- type AggregateExpr
- type BinaryExpr
- type Call
- type EvalStmt
- type Expr
- type Expressions
- type Function
- type Item
- type ItemType
- type Lexer
- type MatrixSelector
- type Node
- type NumberLiteral
- type ParenExpr
- type ParseErr
- type ParseErrors
- type Pos
- type PositionRange
- type SequenceValue
- type Statement
- type StepInvariantExpr
- type StringLiteral
- type SubqueryExpr
- type TestStmt
- type UnaryExpr
- type Value
- type ValueType
- type VectorMatchCardinality
- type VectorMatching
- type VectorSelector
- type Visitor
Constants ¶
const ( EQL = 57346 BLANK = 57347 COLON = 57348 COMMA = 57349 COMMENT = 57350 DURATION = 57351 EOF = 57352 ERROR = 57353 IDENTIFIER = 57354 LEFT_BRACE = 57355 LEFT_BRACKET = 57356 LEFT_PAREN = 57357 METRIC_IDENTIFIER = 57358 NUMBER = 57359 RIGHT_BRACE = 57360 RIGHT_BRACKET = 57361 RIGHT_PAREN = 57362 SEMICOLON = 57363 SPACE = 57364 STRING = 57365 TIMES = 57366 ADD = 57368 DIV = 57369 EQLC = 57370 EQL_REGEX = 57371 GTE = 57372 GTR = 57373 LAND = 57374 LOR = 57375 LSS = 57376 LTE = 57377 LUNLESS = 57378 MOD = 57379 MUL = 57380 NEQ = 57381 NEQ_REGEX = 57382 POW = 57383 SUB = 57384 AT = 57385 ATAN2 = 57386 AVG = 57389 BOTTOMK = 57390 COUNT = 57391 COUNT_VALUES = 57392 GROUP = 57393 MAX = 57394 MIN = 57395 QUANTILE = 57396 STDDEV = 57397 STDVAR = 57398 SUM = 57399 TOPK = 57400 BOOL = 57403 BY = 57404 GROUP_LEFT = 57405 GROUP_RIGHT = 57406 IGNORING = 57407 OFFSET = 57408 ON = 57409 WITHOUT = 57410 START = 57413 END = 57414 START_METRIC = 57417 START_SERIES_DESCRIPTION = 57418 START_EXPRESSION = 57419 START_METRIC_SELECTOR = 57420 )
Variables ¶
var Functions = map[string]*Function{ "abs": { Name: "abs", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "absent": { Name: "absent", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "absent_over_time": { Name: "absent_over_time", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "acos": { Name: "acos", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "acosh": { Name: "acosh", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "asin": { Name: "asin", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "asinh": { Name: "asinh", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "atan": { Name: "atan", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "atanh": { Name: "atanh", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "avg_over_time": { Name: "avg_over_time", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "ceil": { Name: "ceil", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "changes": { Name: "changes", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "clamp": { Name: "clamp", ArgTypes: []ValueType{ValueTypeVector, ValueTypeScalar, ValueTypeScalar}, ReturnType: ValueTypeVector, }, "clamp_max": { Name: "clamp_max", ArgTypes: []ValueType{ValueTypeVector, ValueTypeScalar}, ReturnType: ValueTypeVector, }, "clamp_min": { Name: "clamp_min", ArgTypes: []ValueType{ValueTypeVector, ValueTypeScalar}, ReturnType: ValueTypeVector, }, "cos": { Name: "cos", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "cosh": { Name: "cosh", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "count_over_time": { Name: "count_over_time", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "days_in_month": { Name: "days_in_month", ArgTypes: []ValueType{ValueTypeVector}, Variadic: 1, ReturnType: ValueTypeVector, }, "day_of_month": { Name: "day_of_month", ArgTypes: []ValueType{ValueTypeVector}, Variadic: 1, ReturnType: ValueTypeVector, }, "day_of_week": { Name: "day_of_week", ArgTypes: []ValueType{ValueTypeVector}, Variadic: 1, ReturnType: ValueTypeVector, }, "day_of_year": { Name: "day_of_year", ArgTypes: []ValueType{ValueTypeVector}, Variadic: 1, ReturnType: ValueTypeVector, }, "deg": { Name: "deg", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "delta": { Name: "delta", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "deriv": { Name: "deriv", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "exp": { Name: "exp", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "floor": { Name: "floor", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "histogram_count": { Name: "histogram_count", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "histogram_sum": { Name: "histogram_sum", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "histogram_fraction": { Name: "histogram_fraction", ArgTypes: []ValueType{ValueTypeScalar, ValueTypeScalar, ValueTypeVector}, ReturnType: ValueTypeVector, }, "histogram_quantile": { Name: "histogram_quantile", ArgTypes: []ValueType{ValueTypeScalar, ValueTypeVector}, ReturnType: ValueTypeVector, }, "holt_winters": { Name: "holt_winters", ArgTypes: []ValueType{ValueTypeMatrix, ValueTypeScalar, ValueTypeScalar}, ReturnType: ValueTypeVector, }, "hour": { Name: "hour", ArgTypes: []ValueType{ValueTypeVector}, Variadic: 1, ReturnType: ValueTypeVector, }, "idelta": { Name: "idelta", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "increase": { Name: "increase", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "irate": { Name: "irate", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "label_replace": { Name: "label_replace", ArgTypes: []ValueType{ValueTypeVector, ValueTypeString, ValueTypeString, ValueTypeString, ValueTypeString}, ReturnType: ValueTypeVector, }, "label_join": { Name: "label_join", ArgTypes: []ValueType{ValueTypeVector, ValueTypeString, ValueTypeString, ValueTypeString}, Variadic: -1, ReturnType: ValueTypeVector, }, "last_over_time": { Name: "last_over_time", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "ln": { Name: "ln", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "log10": { Name: "log10", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "log2": { Name: "log2", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "max_over_time": { Name: "max_over_time", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "min_over_time": { Name: "min_over_time", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "minute": { Name: "minute", ArgTypes: []ValueType{ValueTypeVector}, Variadic: 1, ReturnType: ValueTypeVector, }, "month": { Name: "month", ArgTypes: []ValueType{ValueTypeVector}, Variadic: 1, ReturnType: ValueTypeVector, }, "pi": { Name: "pi", ArgTypes: []ValueType{}, ReturnType: ValueTypeScalar, }, "predict_linear": { Name: "predict_linear", ArgTypes: []ValueType{ValueTypeMatrix, ValueTypeScalar}, ReturnType: ValueTypeVector, }, "present_over_time": { Name: "present_over_time", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "quantile_over_time": { Name: "quantile_over_time", ArgTypes: []ValueType{ValueTypeScalar, ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "rad": { Name: "rad", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "rate": { Name: "rate", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "resets": { Name: "resets", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "round": { Name: "round", ArgTypes: []ValueType{ValueTypeVector, ValueTypeScalar}, Variadic: 1, ReturnType: ValueTypeVector, }, "scalar": { Name: "scalar", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeScalar, }, "sgn": { Name: "sgn", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "sin": { Name: "sin", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "sinh": { Name: "sinh", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "sort": { Name: "sort", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "sort_desc": { Name: "sort_desc", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "sqrt": { Name: "sqrt", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "stddev_over_time": { Name: "stddev_over_time", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "stdvar_over_time": { Name: "stdvar_over_time", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "sum_over_time": { Name: "sum_over_time", ArgTypes: []ValueType{ValueTypeMatrix}, ReturnType: ValueTypeVector, }, "tan": { Name: "tan", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "tanh": { Name: "tanh", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "time": { Name: "time", ArgTypes: []ValueType{}, ReturnType: ValueTypeScalar, }, "timestamp": { Name: "timestamp", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "vector": { Name: "vector", ArgTypes: []ValueType{ValueTypeScalar}, ReturnType: ValueTypeVector, }, "year": { Name: "year", ArgTypes: []ValueType{ValueTypeVector}, Variadic: 1, ReturnType: ValueTypeVector, }, }
Functions is a list of all functions supported by PromQL, including their types.
var ItemTypeStr = map[ItemType]string{
LEFT_PAREN: "(",
RIGHT_PAREN: ")",
LEFT_BRACE: "{",
RIGHT_BRACE: "}",
LEFT_BRACKET: "[",
RIGHT_BRACKET: "]",
COMMA: ",",
EQL: "=",
COLON: ":",
SEMICOLON: ";",
BLANK: "_",
TIMES: "x",
SPACE: "<space>",
SUB: "-",
ADD: "+",
MUL: "*",
MOD: "%",
DIV: "/",
EQLC: "==",
NEQ: "!=",
LTE: "<=",
LSS: "<",
GTE: ">=",
GTR: ">",
EQL_REGEX: "=~",
NEQ_REGEX: "!~",
POW: "^",
}
ItemTypeStr is the default string representations for common Items. It does not imply that those are the only character sequences that can be lexed to such an Item.
Functions ¶
func DocumentedType ¶
DocumentedType returns the internal type to the equivalent user facing terminology as defined in the documentation.
func ExtractSelectors ¶
func Inspect ¶
func Inspect(node Node, f inspector)
Inspect traverses an AST in depth-first order: It starts by calling f(node, path); node must not be nil. If f returns a nil error, Inspect invokes f for all the non-nil children of node, recursively.
func MustLabelMatcher ¶
func ParseMetric ¶
ParseMetric parses the input into a metric
func ParseMetricSelector ¶
ParseMetricSelector parses the provided textual metric selector into a list of label matchers.
func Walk ¶
Walk traverses an AST in depth-first order: It starts by calling v.Visit(node, path); node must not be nil. If the visitor w returned by v.Visit(node, path) is not nil and the visitor returns no error, Walk is invoked recursively with visitor w for each of the non-nil children of node, followed by a call of w.Visit(nil), returning an error As the tree is descended the path of previous nodes is provided.
Types ¶
type AggregateExpr ¶
type AggregateExpr struct { Op ItemType // The used aggregation operation. Expr Expr // The Vector expression over which is aggregated. Param Expr // Parameter used by some aggregators. Grouping []string // The labels by which to group the Vector. Without bool // Whether to drop the given labels rather than keep them. PosRange PositionRange }
AggregateExpr represents an aggregation operation on a Vector.
func (*AggregateExpr) PositionRange ¶
func (e *AggregateExpr) PositionRange() PositionRange
func (*AggregateExpr) Pretty ¶ added in v0.38.0
func (e *AggregateExpr) Pretty(level int) string
func (*AggregateExpr) PromQLExpr ¶
func (*AggregateExpr) PromQLExpr()
func (*AggregateExpr) String ¶
func (node *AggregateExpr) String() string
func (*AggregateExpr) Type ¶
func (e *AggregateExpr) Type() ValueType
type BinaryExpr ¶
type BinaryExpr struct { Op ItemType // The operation of the expression. LHS, RHS Expr // The operands on the respective sides of the operator. // The matching behavior for the operation if both operands are Vectors. // If they are not this field is nil. VectorMatching *VectorMatching // If a comparison operator, return 0/1 rather than filtering. ReturnBool bool }
BinaryExpr represents a binary expression between two child expressions.
func (*BinaryExpr) PositionRange ¶
func (e *BinaryExpr) PositionRange() PositionRange
func (*BinaryExpr) Pretty ¶ added in v0.38.0
func (e *BinaryExpr) Pretty(level int) string
func (*BinaryExpr) PromQLExpr ¶
func (*BinaryExpr) PromQLExpr()
func (*BinaryExpr) String ¶
func (node *BinaryExpr) String() string
func (*BinaryExpr) Type ¶
func (e *BinaryExpr) Type() ValueType
type Call ¶
type Call struct { Func *Function // The function that was called. Args Expressions // Arguments used in the call. PosRange PositionRange }
Call represents a function call.
func (*Call) PositionRange ¶
func (e *Call) PositionRange() PositionRange
func (*Call) PromQLExpr ¶
func (*Call) PromQLExpr()
type EvalStmt ¶
type EvalStmt struct { Expr Expr // Expression to be evaluated. // The time boundaries for the evaluation. If Start equals End an instant // is evaluated. Start, End time.Time // Time between two evaluated instants for the range [Start:End]. Interval time.Duration // Lookback delta to use for this evaluation. LookbackDelta time.Duration }
EvalStmt holds an expression and information on the range it should be evaluated on.
func (*EvalStmt) PositionRange ¶
func (e *EvalStmt) PositionRange() PositionRange
func (*EvalStmt) PromQLStmt ¶
func (*EvalStmt) PromQLStmt()
type Expr ¶
type Expr interface { Node // Type returns the type the expression evaluates to. It does not perform // in-depth checks as this is done at parsing-time. Type() ValueType // PromQLExpr ensures that no other types accidentally implement the interface. PromQLExpr() }
Expr is a generic interface for all expression types.
type Expressions ¶
type Expressions []Expr
Expressions is a list of expression nodes that implements Node.
func (Expressions) PositionRange ¶
func (e Expressions) PositionRange() PositionRange
func (Expressions) Pretty ¶ added in v0.38.0
func (e Expressions) Pretty(level int) string
func (Expressions) String ¶
func (es Expressions) String() (s string)
type Function ¶
Function represents a function of the expression language and is used by function nodes.
func MustGetFunction ¶
type Item ¶
type Item struct { Typ ItemType // The type of this Item. Pos Pos // The starting position, in bytes, of this Item in the input string. Val string // The value of this Item. }
Item represents a token or text string returned from the scanner.
func (*Item) PositionRange ¶
func (i *Item) PositionRange() PositionRange
Item implements the Node interface. This makes it possible to call mergeRanges on them.
type ItemType ¶
type ItemType int
func (ItemType) IsAggregator ¶
IsAggregator returns true if the Item belongs to the aggregator functions. Returns false otherwise
func (ItemType) IsAggregatorWithParam ¶
IsAggregatorWithParam returns true if the Item is an aggregator that takes a parameter. Returns false otherwise
func (ItemType) IsComparisonOperator ¶
IsComparisonOperator returns true if the Item corresponds to a comparison operator. Returns false otherwise.
func (ItemType) IsKeyword ¶
IsKeyword returns true if the Item corresponds to a keyword. Returns false otherwise.
func (ItemType) IsOperator ¶
IsOperator returns true if the Item corresponds to a arithmetic or set operator. Returns false otherwise.
func (ItemType) IsSetOperator ¶
IsSetOperator returns whether the Item corresponds to a set operator.
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer holds the state of the scanner.
type MatrixSelector ¶
type MatrixSelector struct { // It is safe to assume that this is an VectorSelector // if the parser hasn't returned an error. VectorSelector Expr Range time.Duration EndPos Pos }
MatrixSelector represents a Matrix selection.
func (*MatrixSelector) PositionRange ¶
func (e *MatrixSelector) PositionRange() PositionRange
func (*MatrixSelector) Pretty ¶ added in v0.38.0
func (e *MatrixSelector) Pretty(level int) string
func (*MatrixSelector) PromQLExpr ¶
func (*MatrixSelector) PromQLExpr()
func (*MatrixSelector) String ¶
func (node *MatrixSelector) String() string
func (*MatrixSelector) Type ¶
func (e *MatrixSelector) Type() ValueType
type Node ¶
type Node interface { // String representation of the node that returns the given node when parsed // as part of a valid query. String() string // Pretty returns the prettified representation of the node. // It uses the level information to determine at which level/depth the current // node is in the AST and uses this to apply indentation. Pretty(level int) string // PositionRange returns the position of the AST Node in the query string. PositionRange() PositionRange }
Node is a generic interface for all nodes in an AST.
Whenever numerous nodes are listed such as in a switch-case statement or a chain of function definitions (e.g. String(), PromQLExpr(), etc.) convention is to list them as follows:
- Statements
- statement types (alphabetical)
- ...
- Expressions
- expression types (alphabetical)
- ...
type NumberLiteral ¶
type NumberLiteral struct { Val float64 PosRange PositionRange }
NumberLiteral represents a number.
func (*NumberLiteral) PositionRange ¶
func (e *NumberLiteral) PositionRange() PositionRange
func (*NumberLiteral) Pretty ¶ added in v0.38.0
func (e *NumberLiteral) Pretty(level int) string
func (*NumberLiteral) PromQLExpr ¶
func (*NumberLiteral) PromQLExpr()
func (*NumberLiteral) String ¶
func (node *NumberLiteral) String() string
func (*NumberLiteral) Type ¶
func (e *NumberLiteral) Type() ValueType
type ParenExpr ¶
type ParenExpr struct { Expr Expr PosRange PositionRange }
ParenExpr wraps an expression so it cannot be disassembled as a consequence of operator precedence.
func (*ParenExpr) PositionRange ¶
func (e *ParenExpr) PositionRange() PositionRange
func (*ParenExpr) PromQLExpr ¶
func (*ParenExpr) PromQLExpr()
type ParseErr ¶
type ParseErr struct { PositionRange PositionRange Err error Query string // LineOffset is an additional line offset to be added. Only used inside unit tests. LineOffset int }
ParseErr wraps a parsing error with line and position context.
type ParseErrors ¶
type ParseErrors []ParseErr
func (ParseErrors) Error ¶
func (errs ParseErrors) Error() string
Since producing multiple error messages might look weird when combined with error wrapping, only the first error produced by the parser is included in the error string. If getting the full error list is desired, it is recommended to typecast the error returned by the parser to ParseErrors and work with the underlying slice.
type Pos ¶
type Pos int
Pos is the position in a string. Negative numbers indicate undefined positions.
type PositionRange ¶
PositionRange describes a position in the input string of the parser.
type SequenceValue ¶
SequenceValue is an omittable value in a sequence of time series values.
func ParseSeriesDesc ¶
func ParseSeriesDesc(input string) (labels labels.Labels, values []SequenceValue, err error)
ParseSeriesDesc parses the description of a time series.
func (SequenceValue) String ¶
func (v SequenceValue) String() string
type Statement ¶
type Statement interface { Node // PromQLStmt ensures that no other type accidentally implements the interface // nolint:unused PromQLStmt() }
Statement is a generic interface for all statements.
type StepInvariantExpr ¶
type StepInvariantExpr struct {
Expr Expr
}
StepInvariantExpr represents a query which evaluates to the same result irrespective of the evaluation time given the raw samples from TSDB remain unchanged. Currently this is only used for engine optimisations and the parser does not produce this.
func (*StepInvariantExpr) PositionRange ¶
func (e *StepInvariantExpr) PositionRange() PositionRange
func (*StepInvariantExpr) Pretty ¶ added in v0.38.0
func (e *StepInvariantExpr) Pretty(level int) string
func (*StepInvariantExpr) PromQLExpr ¶
func (*StepInvariantExpr) PromQLExpr()
func (*StepInvariantExpr) String ¶
func (e *StepInvariantExpr) String() string
func (*StepInvariantExpr) Type ¶
func (e *StepInvariantExpr) Type() ValueType
type StringLiteral ¶
type StringLiteral struct { Val string PosRange PositionRange }
StringLiteral represents a string.
func (*StringLiteral) PositionRange ¶
func (e *StringLiteral) PositionRange() PositionRange
func (*StringLiteral) Pretty ¶ added in v0.38.0
func (e *StringLiteral) Pretty(level int) string
func (*StringLiteral) PromQLExpr ¶
func (*StringLiteral) PromQLExpr()
func (*StringLiteral) String ¶
func (node *StringLiteral) String() string
func (*StringLiteral) Type ¶
func (e *StringLiteral) Type() ValueType
type SubqueryExpr ¶
type SubqueryExpr struct { Expr Expr Range time.Duration // OriginalOffset is the actual offset that was set in the query. // This never changes. OriginalOffset time.Duration // Offset is the offset used during the query execution // which is calculated using the original offset, at modifier time, // eval time, and subquery offsets in the AST tree. Offset time.Duration Timestamp *int64 StartOrEnd ItemType // Set when @ is used with start() or end() Step time.Duration EndPos Pos }
SubqueryExpr represents a subquery.
func (*SubqueryExpr) PositionRange ¶
func (e *SubqueryExpr) PositionRange() PositionRange
func (*SubqueryExpr) Pretty ¶ added in v0.38.0
func (e *SubqueryExpr) Pretty(level int) string
func (*SubqueryExpr) PromQLExpr ¶
func (*SubqueryExpr) PromQLExpr()
func (*SubqueryExpr) String ¶
func (node *SubqueryExpr) String() string
func (*SubqueryExpr) Type ¶
func (e *SubqueryExpr) Type() ValueType
type TestStmt ¶
TestStmt is an internal helper statement that allows execution of an arbitrary function during handling. It is used to test the Engine.
func (TestStmt) PositionRange ¶
func (TestStmt) PositionRange() PositionRange
func (TestStmt) PromQLStmt ¶
func (TestStmt) PromQLStmt()
type UnaryExpr ¶
UnaryExpr represents a unary operation on another expression. Currently unary operations are only supported for Scalars.
func (*UnaryExpr) PositionRange ¶
func (e *UnaryExpr) PositionRange() PositionRange
func (*UnaryExpr) PromQLExpr ¶
func (*UnaryExpr) PromQLExpr()
type VectorMatchCardinality ¶
type VectorMatchCardinality int
VectorMatchCardinality describes the cardinality relationship of two Vectors in a binary operation.
const ( CardOneToOne VectorMatchCardinality = iota CardManyToOne CardOneToMany CardManyToMany )
func (VectorMatchCardinality) String ¶
func (vmc VectorMatchCardinality) String() string
type VectorMatching ¶
type VectorMatching struct { // The cardinality of the two Vectors. Card VectorMatchCardinality // MatchingLabels contains the labels which define equality of a pair of // elements from the Vectors. MatchingLabels []string // On includes the given label names from matching, // rather than excluding them. On bool // Include contains additional labels that should be included in // the result from the side with the lower cardinality. Include []string }
VectorMatching describes how elements from two Vectors in a binary operation are supposed to be matched.
type VectorSelector ¶
type VectorSelector struct { Name string // OriginalOffset is the actual offset that was set in the query. // This never changes. OriginalOffset time.Duration // Offset is the offset used during the query execution // which is calculated using the original offset, at modifier time, // eval time, and subquery offsets in the AST tree. Offset time.Duration Timestamp *int64 StartOrEnd ItemType // Set when @ is used with start() or end() LabelMatchers []*labels.Matcher // The unexpanded seriesSet populated at query preparation time. UnexpandedSeriesSet storage.SeriesSet Series []storage.Series PosRange PositionRange }
VectorSelector represents a Vector selection.
func (*VectorSelector) PositionRange ¶
func (e *VectorSelector) PositionRange() PositionRange
func (*VectorSelector) Pretty ¶ added in v0.38.0
func (e *VectorSelector) Pretty(level int) string
func (*VectorSelector) PromQLExpr ¶
func (*VectorSelector) PromQLExpr()
func (*VectorSelector) String ¶
func (node *VectorSelector) String() string
func (*VectorSelector) Type ¶
func (e *VectorSelector) Type() ValueType
type Visitor ¶
Visitor allows visiting a Node and its child nodes. The Visit method is invoked for each node with the path leading to the node provided additionally. If the result visitor w is not nil and no error, Walk visits each of the children of node with the visitor w, followed by a call of w.Visit(nil, nil).