proxystorage

package
v0.0.59 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MetricNameWorkaroundLabel = "__name"

Variables

This section is empty.

Functions

func CloneExpr added in v0.0.59

func CloneExpr(expr promql.Expr) (newExpr promql.Expr)

func PreserveLabel added in v0.0.59

func PreserveLabel(expr promql.Expr, srcLabel string, dstLabel string) (relabelExpress promql.Expr)

PreserveLabel wraps the input expression with a label replace in order to preserve the metadata through binary expressions

Types

type BooleanFinder

type BooleanFinder struct {
	Func  func(promql.Node) bool
	Found int
}

BooleanFinder uses the given func to determine if something is in there or notret := &promql.VectorSelector{Offset: offset}

func (*BooleanFinder) Visit

func (f *BooleanFinder) Visit(node promql.Node, _ []promql.Node) (promql.Visitor, error)

Visit runs on each node in the tree

type MultiVisitor

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

MultiVisitor runs a set of visitors on the same pass over the node tree

func NewMultiVisitor added in v0.0.59

func NewMultiVisitor(visitors []promql.Visitor) *MultiVisitor

NewMultiVisitor takes a set of visitors and returns a MultiVisitor

func (*MultiVisitor) Visit

func (v *MultiVisitor) Visit(node promql.Node, path []promql.Node) (promql.Visitor, error)

Visit runs on each node in the tree

type OffsetFinder

type OffsetFinder struct {
	Found  bool
	Offset time.Duration
	Error  error
	// contains filtered or unexported fields
}

OffsetFinder finds the offset (if any) within the tree

func (*OffsetFinder) Visit

func (o *OffsetFinder) Visit(node promql.Node, _ []promql.Node) (promql.Visitor, error)

Visit runs on each node in the tree

type OffsetRemover

type OffsetRemover struct{}

OffsetRemover removes any offset found in the node tree This is required when we send the queries below as we want to actually *remove* the offset.

func (*OffsetRemover) Visit

func (o *OffsetRemover) Visit(node promql.Node, _ []promql.Node) (promql.Visitor, error)

Visit runs on each node in the tree

type ProxyStorage

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

ProxyStorage implements prometheus' Storage interface

func NewProxyStorage

func NewProxyStorage() (*ProxyStorage, error)

NewProxyStorage creates a new ProxyStorage

func (*ProxyStorage) Appender

func (p *ProxyStorage) Appender() (storage.Appender, error)

Appender returns a new appender against the storage.

func (*ProxyStorage) ApplyConfig

func (p *ProxyStorage) ApplyConfig(c *proxyconfig.Config) error

ApplyConfig updates the current state of this ProxyStorage

func (*ProxyStorage) Close

func (p *ProxyStorage) Close() error

Close releases the resources of the Querier.

func (*ProxyStorage) GetState

func (p *ProxyStorage) GetState() *proxyStorageState

GetState returns the current state of the ProxyStorage

func (*ProxyStorage) NodeReplacer

func (p *ProxyStorage) NodeReplacer(ctx context.Context, s *promql.EvalStmt, node promql.Node) (promql.Node, error)

NodeReplacer replaces promql Nodes with more efficient-to-fetch ones. This works by taking lower-layer chunks of the query, farming them out to prometheus hosts, then stitching the results back together. An example would be a sum, we can sum multiple sums and come up with the same result -- so we do. There are a few ground rules for this:

  • Children cannot be AggregateExpr: aggregates have their own combining logic, so its not safe to send a subquery with additional aggregations
  • offsets within the subtree must match: if they don't then we'll get mismatched data, so we wait until we are far enough down the tree that they converge
  • Don't reduce accuracy/granularity: the intention of this is to get the correct data faster, meaning correctness overrules speed.

func (*ProxyStorage) Querier

func (p *ProxyStorage) Querier(ctx context.Context, mint, maxt int64) (storage.Querier, error)

Querier returns a new Querier on the storage.

func (*ProxyStorage) StartTime

func (p *ProxyStorage) StartTime() (int64, error)

StartTime returns the oldest timestamp stored in the storage.

Jump to

Keyboard shortcuts

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