promql

package
v1.60.0-cluster Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 34 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjustStartEnd

func AdjustStartEnd(start, end, step int64) (int64, int64)

AdjustStartEnd adjusts start and end values, so response caching may be enabled.

See EvalConfig.mayCache for details.

func Exec

func Exec(ec *EvalConfig, q string, isFirstPointOnly bool) ([]netstorage.Result, error)

Exec executes q for the given ec.

func InitRollupResultCache

func InitRollupResultCache(cachePath string)

InitRollupResultCache initializes the rollupResult cache

if cachePath is empty, then the cache isn't stored to persistent disk.

func IsMetricSelectorWithRollup

func IsMetricSelectorWithRollup(s string) (childQuery string, window, offset string)

IsMetricSelectorWithRollup verifies whether s contains PromQL metric selector wrapped into rollup.

It returns the wrapped query with the corresponding window with offset.

func IsRollup added in v1.31.0

func IsRollup(s string) (childQuery string, window, step, offset string)

IsRollup verifies whether s is a rollup with non-empty window.

It returns the wrapped query with the corresponding window, step and offset.

func ParseMetricSelector

func ParseMetricSelector(s string) ([]storage.TagFilter, error)

ParseMetricSelector parses s containing PromQL metric selector and returns the corresponding LabelFilters.

func ResetRollupResultCache

func ResetRollupResultCache()

ResetRollupResultCache resets rollup result cache.

func StopRollupResultCache

func StopRollupResultCache()

StopRollupResultCache closes the rollupResult cache.

func ValidateMaxPointsPerTimeseries

func ValidateMaxPointsPerTimeseries(start, end, step int64) error

ValidateMaxPointsPerTimeseries checks the maximum number of points that may be returned per each time series.

The number mustn't exceed -search.maxPointsPerTimeseries.

func WriteActiveQueries added in v1.38.0

func WriteActiveQueries(w io.Writer)

WriteActiveQueries writes active queries to w.

The written active queries are sorted in descending order of their exeuction duration.

Types

type EvalConfig

type EvalConfig struct {
	AuthToken *auth.Token
	Start     int64
	End       int64
	Step      int64

	// QuotedRemoteAddr contains quoted remote address.
	QuotedRemoteAddr string

	Deadline searchutils.Deadline

	MayCache bool

	// LookbackDelta is analog to `-query.lookback-delta` from Prometheus.
	LookbackDelta int64

	// How many decimal digits after the point to leave in response.
	RoundDigits int

	// EnforcedTagFilters used for apply additional label filters to query.
	EnforcedTagFilters []storage.TagFilter

	// Whether to deny partial response.
	DenyPartialResponse bool

	// IsPartialResponse is set during query execution and can be used by Exec caller after query execution.
	IsPartialResponse bool
	// contains filtered or unexported fields
}

EvalConfig is the configuration required for query evaluation via Exec

Jump to

Keyboard shortcuts

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