Documentation ¶
Overview ¶
nolint:revive // Many legitimately empty blocks in this file.
Index ¶
- Constants
- Variables
- func DocumentedType(t ValueType) string
- func EnrichParseError(err error, enrich func(parseErr *ParseErr))
- func ExtractSelectors(expr Expr) [][]*labels.Matcher
- func Inspect(node Node, f inspector)
- func MustLabelMatcher(mt labels.MatchType, name, val string) *labels.Matcher
- func NewParser(input string, opts ...Opt) *parser
- 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 Opt
- type ParenExpr
- type ParseErr
- type ParseErrors
- type Parser
- 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 ADD = 57381
const AT = 57398
const ATAN2 = 57399
const AVG = 57402
const BLANK = 57347
const BOOL = 57416
const BOTTOMK = 57403
const BUCKETS_DESC = 57375
const BY = 57417
const CLOSE_HIST = 57359
const COLON = 57348
const COMMA = 57349
const COMMENT = 57350
const COUNT = 57404
const COUNT_DESC = 57371
const COUNT_VALUES = 57405
const DIV = 57382
const DURATION = 57351
const END = 57427
const EOF = 57352
const EQL = 57346
const EQLC = 57383
const EQL_REGEX = 57384
const ERROR = 57353
const GROUP = 57406
const GROUP_LEFT = 57418
const GROUP_RIGHT = 57419
const GTE = 57385
const GTR = 57386
const IDENTIFIER = 57354
const IGNORING = 57420
const LAND = 57387
const LEFT_BRACE = 57355
const LEFT_BRACKET = 57356
const LEFT_PAREN = 57357
const LOR = 57388
const LSS = 57389
const LTE = 57390
const LUNLESS = 57391
const MAX = 57407
const METRIC_IDENTIFIER = 57360
const MIN = 57408
const MOD = 57392
const MUL = 57393
const NEGATIVE_BUCKETS_DESC = 57376
const NEGATIVE_OFFSET_DESC = 57374
const NEQ = 57394
const NEQ_REGEX = 57395
const NUMBER = 57361
const OFFSET = 57421
const OFFSET_DESC = 57373
const ON = 57422
const OPEN_HIST = 57358
const POW = 57396
const QUANTILE = 57409
const RIGHT_BRACE = 57362
const RIGHT_BRACKET = 57363
const RIGHT_PAREN = 57364
const SCHEMA_DESC = 57372
const SEMICOLON = 57365
const SPACE = 57366
const START = 57426
const START_EXPRESSION = 57432
const START_METRIC = 57430
const START_METRIC_SELECTOR = 57433
const START_SERIES_DESCRIPTION = 57431
const STDDEV = 57410
const STDVAR = 57411
const STRING = 57367
const SUB = 57397
const SUM = 57412
const SUM_DESC = 57370
const TIMES = 57368
const TOPK = 57413
const WITHOUT = 57423
const ZERO_BUCKET_DESC = 57377
const ZERO_BUCKET_WIDTH_DESC = 57378
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_stddev": { Name: "histogram_stddev", ArgTypes: []ValueType{ValueTypeVector}, ReturnType: ValueTypeVector, }, "histogram_stdvar": { Name: "histogram_stdvar", 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{
OPEN_HIST: "{{",
CLOSE_HIST: "}}",
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 EnrichParseError ¶ added in v0.47.0
EnrichParseError enriches a single or list of parse errors (used for unit tests and promtool).
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 posrange.PositionRange }
AggregateExpr represents an aggregation operation on a Vector.
func (*AggregateExpr) PositionRange ¶
func (e *AggregateExpr) PositionRange() posrange.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() posrange.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 posrange.PositionRange }
Call represents a function call.
func (*Call) PositionRange ¶
func (e *Call) PositionRange() posrange.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() posrange.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() posrange.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 posrange.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() posrange.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 posrange.Pos }
MatrixSelector represents a Matrix selection.
func (*MatrixSelector) PositionRange ¶
func (e *MatrixSelector) PositionRange() posrange.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() posrange.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 posrange.PositionRange }
NumberLiteral represents a number.
func (*NumberLiteral) PositionRange ¶
func (e *NumberLiteral) PositionRange() posrange.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 posrange.PositionRange }
ParenExpr wraps an expression so it cannot be disassembled as a consequence of operator precedence.
func (*ParenExpr) PositionRange ¶
func (e *ParenExpr) PositionRange() posrange.PositionRange
func (*ParenExpr) PromQLExpr ¶
func (*ParenExpr) PromQLExpr()
type ParseErr ¶
type ParseErr struct { PositionRange posrange.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 SequenceValue ¶
type SequenceValue struct { Value float64 Omitted bool Histogram *histogram.FloatHistogram }
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() posrange.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 posrange.PositionRange }
StringLiteral represents a string.
func (*StringLiteral) PositionRange ¶
func (e *StringLiteral) PositionRange() posrange.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 posrange.Pos }
SubqueryExpr represents a subquery.
func (*SubqueryExpr) PositionRange ¶
func (e *SubqueryExpr) PositionRange() posrange.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() posrange.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() posrange.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 posrange.PositionRange }
VectorSelector represents a Vector selection.
func (*VectorSelector) PositionRange ¶
func (e *VectorSelector) PositionRange() posrange.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).