2019-12-25 19:35:47 +00:00
|
|
|
package metricsql
|
2019-12-08 22:52:31 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
var rollupFuncs = map[string]bool{
|
|
|
|
// Standard rollup funcs from PromQL.
|
|
|
|
// See funcs accepting range-vector on https://prometheus.io/docs/prometheus/latest/querying/functions/ .
|
|
|
|
"changes": true,
|
|
|
|
"delta": true,
|
|
|
|
"deriv": true,
|
|
|
|
"deriv_fast": true,
|
|
|
|
"holt_winters": true,
|
|
|
|
"idelta": true,
|
|
|
|
"increase": true,
|
|
|
|
"irate": true,
|
|
|
|
"predict_linear": true,
|
|
|
|
"rate": true,
|
|
|
|
"resets": true,
|
|
|
|
"avg_over_time": true,
|
|
|
|
"min_over_time": true,
|
|
|
|
"max_over_time": true,
|
|
|
|
"sum_over_time": true,
|
|
|
|
"count_over_time": true,
|
|
|
|
"quantile_over_time": true,
|
|
|
|
"stddev_over_time": true,
|
|
|
|
"stdvar_over_time": true,
|
2020-01-03 22:46:39 +00:00
|
|
|
"absent_over_time": true,
|
2019-12-08 22:52:31 +00:00
|
|
|
|
|
|
|
// Additional rollup funcs.
|
2020-01-11 12:40:32 +00:00
|
|
|
"default_rollup": true,
|
2020-01-21 17:05:10 +00:00
|
|
|
"range_over_time": true,
|
2020-01-11 12:40:32 +00:00
|
|
|
"sum2_over_time": true,
|
|
|
|
"geomean_over_time": true,
|
|
|
|
"first_over_time": true,
|
|
|
|
"last_over_time": true,
|
|
|
|
"distinct_over_time": true,
|
|
|
|
"increases_over_time": true,
|
|
|
|
"decreases_over_time": true,
|
|
|
|
"integrate": true,
|
|
|
|
"ideriv": true,
|
|
|
|
"lifetime": true,
|
|
|
|
"lag": true,
|
|
|
|
"scrape_interval": true,
|
|
|
|
"tmin_over_time": true,
|
|
|
|
"tmax_over_time": true,
|
|
|
|
"share_le_over_time": true,
|
|
|
|
"share_gt_over_time": true,
|
|
|
|
"histogram_over_time": true,
|
|
|
|
"rollup": true,
|
|
|
|
"rollup_rate": true,
|
|
|
|
"rollup_deriv": true,
|
|
|
|
"rollup_delta": true,
|
|
|
|
"rollup_increase": true,
|
|
|
|
"rollup_candlestick": true,
|
|
|
|
"aggr_over_time": true,
|
|
|
|
"hoeffding_bound_upper": true,
|
|
|
|
"hoeffding_bound_lower": true,
|
2020-04-15 09:00:39 +00:00
|
|
|
|
|
|
|
// `timestamp` func has been moved here because it must work properly with offsets and samples unaligned to the current step.
|
|
|
|
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415 for details.
|
|
|
|
"timestamp": true,
|
2019-12-08 22:52:31 +00:00
|
|
|
}
|
|
|
|
|
2020-01-04 11:24:57 +00:00
|
|
|
// IsRollupFunc returns whether funcName is known rollup function.
|
|
|
|
func IsRollupFunc(funcName string) bool {
|
|
|
|
s := strings.ToLower(funcName)
|
|
|
|
return rollupFuncs[s]
|
2019-12-08 22:52:31 +00:00
|
|
|
}
|