Documentation ¶
Index ¶
- func ActiveQueriesHandler(w http.ResponseWriter, _ *http.Request)
- func AdjustStartEnd(start, end, step int64) (int64, int64)
- func Exec(qt *querytracer.Tracer, ec *EvalConfig, q string, isFirstPointOnly bool) ([]netstorage.Result, error)
- func InitRollupResultCache(cachePath string)
- func IsMetricSelectorWithRollup(s string) (childQuery string, window, offset *metricsql.DurationExpr)
- func IsRollup(s string) (childQuery string, window, step, offset *metricsql.DurationExpr)
- func ResetRollupResultCache()
- func ResetRollupResultCacheIfNeeded(mrs []storage.MetricRow)
- func StopRollupResultCache()
- func ValidateMaxPointsPerSeries(start, end, step int64, maxPoints int) error
- type EvalConfig
- type QueryStats
- type UserReadableError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActiveQueriesHandler ¶ added in v1.92.0
func ActiveQueriesHandler(w http.ResponseWriter, _ *http.Request)
ActiveQueriesHandler returns response to /api/v1/status/active_queries
It writes a JSON with active queries to w.
func AdjustStartEnd ¶
AdjustStartEnd adjusts start and end values, so response caching may be enabled.
See EvalConfig.mayCache() for details.
func Exec ¶
func Exec(qt *querytracer.Tracer, 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.
ResetRollupResultCache must be called when the cache must be reset. StopRollupResultCache must be called when the cache isn't needed anymore.
func IsMetricSelectorWithRollup ¶
func IsMetricSelectorWithRollup(s string) (childQuery string, window, offset *metricsql.DurationExpr)
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 *metricsql.DurationExpr)
IsRollup verifies whether s is a rollup with non-empty window.
It returns the wrapped query with the corresponding window, step and offset.
func ResetRollupResultCache ¶
func ResetRollupResultCache()
ResetRollupResultCache resets rollup result cache.
func ResetRollupResultCacheIfNeeded ¶ added in v1.50.0
ResetRollupResultCacheIfNeeded resets rollup result cache if mrs contains timestamps outside `now - search.cacheTimestampOffset`.
func StopRollupResultCache ¶
func StopRollupResultCache()
StopRollupResultCache closes the rollupResult cache.
func ValidateMaxPointsPerSeries ¶ added in v1.81.0
ValidateMaxPointsPerSeries validates that the number of points for the given start, end and step do not exceed maxPoints.
Types ¶
type EvalConfig ¶
type EvalConfig struct { Start int64 End int64 Step int64 // MaxSeries is the maximum number of time series, which can be scanned by the query. // Zero means 'no limit' MaxSeries int // MaxPointsPerSeries is the limit on the number of points, which can be generated per each returned time series. MaxPointsPerSeries int // QuotedRemoteAddr contains quoted remote address. QuotedRemoteAddr string Deadline searchutils.Deadline // Whether the response can be cached. 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 // EnforcedTagFilterss may contain additional label filters to use in the query. EnforcedTagFilterss [][]storage.TagFilter // The callback, which returns the request URI during logging. // The request URI isn't stored here because its' construction may take non-trivial amounts of CPU. GetRequestURI func() string // QueryStats contains various stats for the currently executed query. // // The caller must initialize QueryStats, otherwise it isn't collected. QueryStats *QueryStats // contains filtered or unexported fields }
EvalConfig is the configuration required for query evaluation via Exec
type QueryStats ¶ added in v1.90.0
type QueryStats struct { // SeriesFetched contains the number of series fetched from storage during the query evaluation. SeriesFetched int64 // ExecutionTimeMsec contains the number of milliseconds the query took to execute. ExecutionTimeMsec int64 }
QueryStats contains various stats for the query.
type UserReadableError ¶ added in v1.81.0
type UserReadableError struct { // Err is the error which needs to be returned to the user. Err error }
UserReadableError is a type of error which supposed to be returned to the user without additional context.
func (*UserReadableError) Error ¶ added in v1.81.0
func (ure *UserReadableError) Error() string
Error satisfies Error interface
func (*UserReadableError) Unwrap ¶ added in v1.81.0
func (ure *UserReadableError) Unwrap() error
Unwrap returns ure.Err.
This is used by standard errors package. See https://golang.org/pkg/errors