proxystorage

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2018 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BooleanFinder

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

Use 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) (w promql.Visitor)

type OffsetFinder

type OffsetFinder struct {
	Found  bool
	Offset time.Duration
	Error  error
}

TODO: move?

func (*OffsetFinder) Visit

func (o *OffsetFinder) Visit(node promql.Node) (w promql.Visitor)

type OffsetRemover

type OffsetRemover struct{}

When we send the queries below, we want to actually *remove* the offset.

func (*OffsetRemover) Visit

func (o *OffsetRemover) Visit(node promql.Node) (w promql.Visitor)

type ProxyStorage

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

TODO: rename?

func NewProxyStorage

func NewProxyStorage() (*ProxyStorage, error)

func (*ProxyStorage) Append

func (p *ProxyStorage) Append(*model.Sample) error

Append appends a sample to the underlying storage. Depending on the storage implementation, there are different guarantees for the fate of the sample after Append has returned. Remote storage implementation will simply drop samples if they cannot keep up with sending samples. Local storage implementations will only drop metrics upon unrecoverable errors.

func (*ProxyStorage) ApplyConfig

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

func (*ProxyStorage) DropMetricsForLabelMatchers

func (p *ProxyStorage) DropMetricsForLabelMatchers(context.Context, ...*metric.LabelMatcher) (int, error)

Drop all time series associated with the given label matchers. Returns the number series that were dropped.

func (*ProxyStorage) GetSGs

func (p *ProxyStorage) GetSGs() []*servergroup.ServerGroup

TODO: remove

func (*ProxyStorage) GetState

func (p *ProxyStorage) GetState() *proxyStorageState

func (*ProxyStorage) NeedsThrottling

func (p *ProxyStorage) NeedsThrottling() bool

NeedsThrottling returns true if the underlying storage wishes to not receive any more samples. Append will still work but might lead to undue resource usage. It is recommended to call NeedsThrottling once before an upcoming batch of Append calls (e.g. a full scrape of a target or the evaluation of a rule group) and only proceed with the batch if NeedsThrottling returns false. In that way, the result of a scrape or of an evaluation of a rule group will always be appended completely or not at all, and the work of scraping or evaluation will not be performed in vain. Also, a call of NeedsThrottling is potentially expensive, so limiting the number of calls is reasonable.

Only SampleAppenders for which it is considered critical to receive each and every sample should ever return true. SampleAppenders that tolerate not receiving all samples should always return false and instead drop samples as they see fit to avoid overload.

func (*ProxyStorage) NodeReplacer

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

This 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) ProxyHandler

func (p *ProxyStorage) ProxyHandler(w http.ResponseWriter, r *http.Request)

Handler to proxy requests to *a* server in serverGroups

func (*ProxyStorage) Querier

func (p *ProxyStorage) Querier() (local.Querier, error)

func (*ProxyStorage) Start

func (p *ProxyStorage) Start() error

Run the various maintenance loops in goroutines. Returns when the storage is ready to use. Keeps everything running in the background until Stop is called.

func (*ProxyStorage) Stop

func (p *ProxyStorage) Stop() error

Stop shuts down the Storage gracefully, flushes all pending operations, stops all maintenance loops,and frees all resources.

func (*ProxyStorage) WaitForIndexing

func (p *ProxyStorage) WaitForIndexing()

WaitForIndexing returns once all samples in the storage are indexed. Indexing is needed for FingerprintsForLabelMatchers and LabelValuesForLabelName and may lag behind.

Jump to

Keyboard shortcuts

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