Documentation
¶
Overview ¶
Package promql implements a PromQL subset: selectors, range functions, aggregations and binary operators.
Index ¶
- Constants
- Variables
- func Fingerprint(l Labels) string
- func MatchesAll(lbls Labels, ms []*Matcher) bool
- func ParseDuration(s string) (time.Duration, error)
- func ResultType(v Value) string
- type Aggregation
- type Binary
- type Call
- type Engine
- type Expr
- type Labels
- type MatchType
- type Matcher
- type Matrix
- type MatrixSelector
- type NumberLit
- type Sample
- type Scalar
- type Series
- type Storage
- type StringLit
- type StringValue
- type Unary
- type Value
- type Vector
- type VectorSample
- type VectorSelector
Constants ¶
const DefaultLookback = 5 * time.Minute
DefaultLookback is how far back an instant selector looks for a sample.
const MaxRangeSteps = 11000
MaxRangeSteps bounds a range query's resolution like Prometheus.
const NameLabel = "__name__"
NameLabel is the label that carries the metric name.
Variables ¶
var ErrEval = errors.New("execution error")
ErrEval marks an evaluation failure.
var ErrSyntax = errors.New("parse error")
ErrSyntax marks a parse failure.
Functions ¶
func Fingerprint ¶
Fingerprint is a canonical string for a label set.
func MatchesAll ¶
MatchesAll reports whether lbls satisfies every matcher.
func ParseDuration ¶
ParseDuration parses a PromQL duration such as 5m or 1h30m.
Types ¶
type Aggregation ¶
Aggregation reduces a vector across series.
type Engine ¶
Engine evaluates expressions against a Storage.
type Expr ¶
type Expr interface {
// contains filtered or unexported methods
}
Expr is a parsed PromQL expression.
type Matcher ¶
type Matcher struct {
Name string
Value string
Type MatchType
// contains filtered or unexported fields
}
Matcher filters series by one label.
func NewMatcher ¶
NewMatcher builds a matcher; regular expressions are fully anchored like Prometheus.
type MatrixSelector ¶
type MatrixSelector struct {
VS *VectorSelector
Range time.Duration
}
MatrixSelector selects a window of samples per series.
type Storage ¶
type Storage interface {
// Select returns series matching ms with at least the samples in [minT, maxT] (Unix ms).
Select(ms []*Matcher, minT, maxT int64) []Series
}
Storage supplies series to the engine.
type Value ¶
type Value interface {
// contains filtered or unexported methods
}
Value is the result of evaluating an expression.
type VectorSample ¶
VectorSample is one instant sample of a labelled series.