logicalplan

package
v0.0.0-...-3e34b56 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoOptimizers  = []Optimizer{}
	AllOptimizers = append(DefaultOptimizers, PropagateMatchersOptimizer{})
)
View Source
var DefaultOptimizers = []Optimizer{
	SortMatchers{},
	MergeSelectsOptimizer{},
}

Functions

This section is empty.

Types

type Deduplicate

type Deduplicate struct {
	Expressions RemoteExecutions
}

Deduplicate is a logical plan which deduplicates samples from multiple RemoteExecutions.

func (Deduplicate) PositionRange

func (r Deduplicate) PositionRange() parser.PositionRange

func (Deduplicate) Pretty

func (r Deduplicate) Pretty(level int) string

func (Deduplicate) PromQLExpr

func (r Deduplicate) PromQLExpr()

func (Deduplicate) String

func (r Deduplicate) String() string

func (Deduplicate) Type

func (r Deduplicate) Type() parser.ValueType

type DistributedExecutionOptimizer

type DistributedExecutionOptimizer struct {
	Endpoints api.RemoteEndpoints
}

DistributedExecutionOptimizer produces a logical plan suitable for distributed Query execution.

func (DistributedExecutionOptimizer) Optimize

func (m DistributedExecutionOptimizer) Optimize(plan parser.Expr, opts *Opts) parser.Expr

type FilteredSelector

type FilteredSelector struct {
	*parser.VectorSelector
	Filters []*labels.Matcher
}

func (FilteredSelector) PositionRange

func (f FilteredSelector) PositionRange() parser.PositionRange

func (FilteredSelector) Pretty

func (f FilteredSelector) Pretty(level int) string

func (FilteredSelector) PromQLExpr

func (f FilteredSelector) PromQLExpr()

func (FilteredSelector) String

func (f FilteredSelector) String() string

func (FilteredSelector) Type

type MergeSelectsOptimizer

type MergeSelectsOptimizer struct{}

MergeSelectsOptimizer optimizes a binary expression where one select is a superset of the other select. For example, the expression:

metric{a="b", c="d"} / scalar(metric{a="b"}) becomes:
Filter(c="d", metric{a="b"}) / scalar(metric{a="b"}).

The engine can then cache the result of `metric{a="b"}` and apply an additional filter for {c="d"}.

func (MergeSelectsOptimizer) Optimize

func (m MergeSelectsOptimizer) Optimize(expr parser.Expr, _ *Opts) parser.Expr

type Noop

type Noop struct{}

func (Noop) PositionRange

func (r Noop) PositionRange() parser.PositionRange

func (Noop) Pretty

func (r Noop) Pretty(level int) string

func (Noop) PromQLExpr

func (r Noop) PromQLExpr()

func (Noop) String

func (r Noop) String() string

func (Noop) Type

func (r Noop) Type() parser.ValueType

type Optimizer

type Optimizer interface {
	Optimize(expr parser.Expr, opts *Opts) parser.Expr
}

type Opts

type Opts struct {
	Start         time.Time
	End           time.Time
	Step          time.Duration
	LookbackDelta time.Duration
}

func (Opts) IsInstantQuery

func (o Opts) IsInstantQuery() bool

type Plan

type Plan interface {
	Optimize([]Optimizer) Plan
	Expr() parser.Expr
}

func New

func New(expr parser.Expr, opts *Opts) Plan

type PropagateMatchersOptimizer

type PropagateMatchersOptimizer struct{}

PropagateMatchersOptimizer implements matcher propagation between two vector selectors in a binary expression.

func (PropagateMatchersOptimizer) Optimize

func (m PropagateMatchersOptimizer) Optimize(expr parser.Expr, _ *Opts) parser.Expr

type RemoteExecution

type RemoteExecution struct {
	Engine          api.RemoteEngine
	Query           string
	QueryRangeStart time.Time
}

RemoteExecution is a logical plan that describes a remote execution of a Query against the given PromQL Engine.

func (RemoteExecution) PositionRange

func (r RemoteExecution) PositionRange() parser.PositionRange

func (RemoteExecution) Pretty

func (r RemoteExecution) Pretty(level int) string

func (RemoteExecution) PromQLExpr

func (r RemoteExecution) PromQLExpr()

func (RemoteExecution) String

func (r RemoteExecution) String() string

func (RemoteExecution) Type

func (r RemoteExecution) Type() parser.ValueType

type RemoteExecutions

type RemoteExecutions []RemoteExecution

func (RemoteExecutions) String

func (rs RemoteExecutions) String() string

type SortMatchers

type SortMatchers struct{}

SortMatchers sorts all matchers in a selector so that all subsequent optimizers, both in the logical and physical plan, can rely on this property.

func (SortMatchers) Optimize

func (m SortMatchers) Optimize(expr parser.Expr, _ *Opts) parser.Expr

type TrimSortFunctions

type TrimSortFunctions struct {
}

TrimSortFunctions trims sort functions. It can do that because for nested sort functions we can safely say f(sort(X)) == f(X). Top-level sort functions are handled by the engine when presenting the query results. The engine depends on this optimizer to be able to ignore the 'sort' and 'sort_desc' functions when building its Operator tree.

func (TrimSortFunctions) Optimize

func (TrimSortFunctions) Optimize(expr parser.Expr, _ *Opts) parser.Expr

Jump to

Keyboard shortcuts

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