mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmselect/promql: arrange function names in the code in alphabetical order
This should simplify code maintenance in the future
This commit is contained in:
parent
b585a550ba
commit
f43586c63c
9 changed files with 437 additions and 466 deletions
|
@ -15,45 +15,42 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var aggrFuncs = map[string]aggrFunc{
|
var aggrFuncs = map[string]aggrFunc{
|
||||||
// See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
|
"any": aggrFuncAny,
|
||||||
"sum": newAggrFunc(aggrFuncSum),
|
"avg": newAggrFunc(aggrFuncAvg),
|
||||||
"min": newAggrFunc(aggrFuncMin),
|
"bottomk": newAggrFuncTopK(true),
|
||||||
"max": newAggrFunc(aggrFuncMax),
|
|
||||||
"avg": newAggrFunc(aggrFuncAvg),
|
|
||||||
"stddev": newAggrFunc(aggrFuncStddev),
|
|
||||||
"stdvar": newAggrFunc(aggrFuncStdvar),
|
|
||||||
"count": newAggrFunc(aggrFuncCount),
|
|
||||||
"count_values": aggrFuncCountValues,
|
|
||||||
"bottomk": newAggrFuncTopK(true),
|
|
||||||
"topk": newAggrFuncTopK(false),
|
|
||||||
"quantile": aggrFuncQuantile,
|
|
||||||
"group": newAggrFunc(aggrFuncGroup),
|
|
||||||
|
|
||||||
// PromQL extension funcs
|
|
||||||
"median": aggrFuncMedian,
|
|
||||||
"limitk": aggrFuncLimitK,
|
|
||||||
"limit_offset": aggrFuncLimitOffset,
|
|
||||||
"distinct": newAggrFunc(aggrFuncDistinct),
|
|
||||||
"sum2": newAggrFunc(aggrFuncSum2),
|
|
||||||
"geomean": newAggrFunc(aggrFuncGeomean),
|
|
||||||
"histogram": newAggrFunc(aggrFuncHistogram),
|
|
||||||
"topk_min": newAggrFuncRangeTopK(minValue, false),
|
|
||||||
"topk_max": newAggrFuncRangeTopK(maxValue, false),
|
|
||||||
"topk_avg": newAggrFuncRangeTopK(avgValue, false),
|
|
||||||
"topk_median": newAggrFuncRangeTopK(medianValue, false),
|
|
||||||
"topk_last": newAggrFuncRangeTopK(lastValue, false),
|
|
||||||
"bottomk_min": newAggrFuncRangeTopK(minValue, true),
|
|
||||||
"bottomk_max": newAggrFuncRangeTopK(maxValue, true),
|
|
||||||
"bottomk_avg": newAggrFuncRangeTopK(avgValue, true),
|
"bottomk_avg": newAggrFuncRangeTopK(avgValue, true),
|
||||||
|
"bottomk_max": newAggrFuncRangeTopK(maxValue, true),
|
||||||
"bottomk_median": newAggrFuncRangeTopK(medianValue, true),
|
"bottomk_median": newAggrFuncRangeTopK(medianValue, true),
|
||||||
"bottomk_last": newAggrFuncRangeTopK(lastValue, true),
|
"bottomk_last": newAggrFuncRangeTopK(lastValue, true),
|
||||||
"any": aggrFuncAny,
|
"bottomk_min": newAggrFuncRangeTopK(minValue, true),
|
||||||
|
"count": newAggrFunc(aggrFuncCount),
|
||||||
|
"count_values": aggrFuncCountValues,
|
||||||
|
"distinct": newAggrFunc(aggrFuncDistinct),
|
||||||
|
"geomean": newAggrFunc(aggrFuncGeomean),
|
||||||
|
"group": newAggrFunc(aggrFuncGroup),
|
||||||
|
"histogram": newAggrFunc(aggrFuncHistogram),
|
||||||
|
"limit_offset": aggrFuncLimitOffset,
|
||||||
|
"limitk": aggrFuncLimitK,
|
||||||
"mad": newAggrFunc(aggrFuncMAD),
|
"mad": newAggrFunc(aggrFuncMAD),
|
||||||
|
"max": newAggrFunc(aggrFuncMax),
|
||||||
|
"median": aggrFuncMedian,
|
||||||
|
"min": newAggrFunc(aggrFuncMin),
|
||||||
|
"mode": newAggrFunc(aggrFuncMode),
|
||||||
"outliers_mad": aggrFuncOutliersMAD,
|
"outliers_mad": aggrFuncOutliersMAD,
|
||||||
"outliersk": aggrFuncOutliersK,
|
"outliersk": aggrFuncOutliersK,
|
||||||
"mode": newAggrFunc(aggrFuncMode),
|
"quantile": aggrFuncQuantile,
|
||||||
"zscore": aggrFuncZScore,
|
|
||||||
"quantiles": aggrFuncQuantiles,
|
"quantiles": aggrFuncQuantiles,
|
||||||
|
"stddev": newAggrFunc(aggrFuncStddev),
|
||||||
|
"stdvar": newAggrFunc(aggrFuncStdvar),
|
||||||
|
"sum": newAggrFunc(aggrFuncSum),
|
||||||
|
"sum2": newAggrFunc(aggrFuncSum2),
|
||||||
|
"topk": newAggrFuncTopK(false),
|
||||||
|
"topk_avg": newAggrFuncRangeTopK(avgValue, false),
|
||||||
|
"topk_max": newAggrFuncRangeTopK(maxValue, false),
|
||||||
|
"topk_median": newAggrFuncRangeTopK(medianValue, false),
|
||||||
|
"topk_last": newAggrFuncRangeTopK(lastValue, false),
|
||||||
|
"topk_min": newAggrFuncRangeTopK(minValue, false),
|
||||||
|
"zscore": aggrFuncZScore,
|
||||||
}
|
}
|
||||||
|
|
||||||
type aggrFunc func(afa *aggrFuncArg) ([]*timeseries, error)
|
type aggrFunc func(afa *aggrFuncArg) ([]*timeseries, error)
|
||||||
|
|
|
@ -19,131 +19,121 @@ var minStalenessInterval = flag.Duration("search.minStalenessInterval", 0, "The
|
||||||
"See also '-search.maxStalenessInterval'")
|
"See also '-search.maxStalenessInterval'")
|
||||||
|
|
||||||
var rollupFuncs = map[string]newRollupFunc{
|
var rollupFuncs = map[string]newRollupFunc{
|
||||||
// Standard rollup funcs from PromQL.
|
"absent_over_time": newRollupFuncOneArg(rollupAbsent),
|
||||||
// See funcs accepting range-vector on https://prometheus.io/docs/prometheus/latest/querying/functions/ .
|
|
||||||
"changes": newRollupFuncOneArg(rollupChanges),
|
|
||||||
"delta": newRollupFuncOneArg(rollupDelta),
|
|
||||||
"deriv": newRollupFuncOneArg(rollupDerivSlow),
|
|
||||||
"deriv_fast": newRollupFuncOneArg(rollupDerivFast),
|
|
||||||
"holt_winters": newRollupHoltWinters,
|
|
||||||
"idelta": newRollupFuncOneArg(rollupIdelta),
|
|
||||||
"increase": newRollupFuncOneArg(rollupDelta), // + rollupFuncsRemoveCounterResets
|
|
||||||
"irate": newRollupFuncOneArg(rollupIderiv), // + rollupFuncsRemoveCounterResets
|
|
||||||
"predict_linear": newRollupPredictLinear,
|
|
||||||
"rate": newRollupFuncOneArg(rollupDerivFast), // + rollupFuncsRemoveCounterResets
|
|
||||||
"resets": newRollupFuncOneArg(rollupResets),
|
|
||||||
"avg_over_time": newRollupFuncOneArg(rollupAvg),
|
|
||||||
"min_over_time": newRollupFuncOneArg(rollupMin),
|
|
||||||
"max_over_time": newRollupFuncOneArg(rollupMax),
|
|
||||||
"sum_over_time": newRollupFuncOneArg(rollupSum),
|
|
||||||
"count_over_time": newRollupFuncOneArg(rollupCount),
|
|
||||||
"quantile_over_time": newRollupQuantile,
|
|
||||||
"stddev_over_time": newRollupFuncOneArg(rollupStddev),
|
|
||||||
"stdvar_over_time": newRollupFuncOneArg(rollupStdvar),
|
|
||||||
"absent_over_time": newRollupFuncOneArg(rollupAbsent),
|
|
||||||
"present_over_time": newRollupFuncOneArg(rollupPresent),
|
|
||||||
"last_over_time": newRollupFuncOneArg(rollupLast),
|
|
||||||
|
|
||||||
// Additional rollup funcs.
|
|
||||||
"default_rollup": newRollupFuncOneArg(rollupDefault), // default rollup func
|
|
||||||
"range_over_time": newRollupFuncOneArg(rollupRange),
|
|
||||||
"sum2_over_time": newRollupFuncOneArg(rollupSum2),
|
|
||||||
"geomean_over_time": newRollupFuncOneArg(rollupGeomean),
|
|
||||||
"first_over_time": newRollupFuncOneArg(rollupFirst),
|
|
||||||
"distinct_over_time": newRollupFuncOneArg(rollupDistinct),
|
|
||||||
"increases_over_time": newRollupFuncOneArg(rollupIncreases),
|
|
||||||
"decreases_over_time": newRollupFuncOneArg(rollupDecreases),
|
|
||||||
"increase_pure": newRollupFuncOneArg(rollupIncreasePure), // + rollupFuncsRemoveCounterResets
|
|
||||||
"integrate": newRollupFuncOneArg(rollupIntegrate),
|
|
||||||
"ideriv": newRollupFuncOneArg(rollupIderiv),
|
|
||||||
"lifetime": newRollupFuncOneArg(rollupLifetime),
|
|
||||||
"lag": newRollupFuncOneArg(rollupLag),
|
|
||||||
"scrape_interval": newRollupFuncOneArg(rollupScrapeInterval),
|
|
||||||
"tmin_over_time": newRollupFuncOneArg(rollupTmin),
|
|
||||||
"tmax_over_time": newRollupFuncOneArg(rollupTmax),
|
|
||||||
"tfirst_over_time": newRollupFuncOneArg(rollupTfirst),
|
|
||||||
"tlast_over_time": newRollupFuncOneArg(rollupTlast),
|
|
||||||
"duration_over_time": newRollupDurationOverTime,
|
|
||||||
"share_le_over_time": newRollupShareLE,
|
|
||||||
"share_gt_over_time": newRollupShareGT,
|
|
||||||
"count_le_over_time": newRollupCountLE,
|
|
||||||
"count_gt_over_time": newRollupCountGT,
|
|
||||||
"count_eq_over_time": newRollupCountEQ,
|
|
||||||
"count_ne_over_time": newRollupCountNE,
|
|
||||||
"histogram_over_time": newRollupFuncOneArg(rollupHistogram),
|
|
||||||
"rollup": newRollupFuncOneArg(rollupFake),
|
|
||||||
"rollup_rate": newRollupFuncOneArg(rollupFake), // + rollupFuncsRemoveCounterResets
|
|
||||||
"rollup_deriv": newRollupFuncOneArg(rollupFake),
|
|
||||||
"rollup_delta": newRollupFuncOneArg(rollupFake),
|
|
||||||
"rollup_increase": newRollupFuncOneArg(rollupFake), // + rollupFuncsRemoveCounterResets
|
|
||||||
"rollup_candlestick": newRollupFuncOneArg(rollupFake),
|
|
||||||
"rollup_scrape_interval": newRollupFuncOneArg(rollupFake),
|
|
||||||
"aggr_over_time": newRollupFuncTwoArgs(rollupFake),
|
"aggr_over_time": newRollupFuncTwoArgs(rollupFake),
|
||||||
"hoeffding_bound_upper": newRollupHoeffdingBoundUpper,
|
|
||||||
"hoeffding_bound_lower": newRollupHoeffdingBoundLower,
|
|
||||||
"ascent_over_time": newRollupFuncOneArg(rollupAscentOverTime),
|
"ascent_over_time": newRollupFuncOneArg(rollupAscentOverTime),
|
||||||
|
"avg_over_time": newRollupFuncOneArg(rollupAvg),
|
||||||
|
"changes": newRollupFuncOneArg(rollupChanges),
|
||||||
|
"count_eq_over_time": newRollupCountEQ,
|
||||||
|
"count_gt_over_time": newRollupCountGT,
|
||||||
|
"count_le_over_time": newRollupCountLE,
|
||||||
|
"count_ne_over_time": newRollupCountNE,
|
||||||
|
"count_over_time": newRollupFuncOneArg(rollupCount),
|
||||||
|
"decreases_over_time": newRollupFuncOneArg(rollupDecreases),
|
||||||
|
"default_rollup": newRollupFuncOneArg(rollupDefault), // default rollup func
|
||||||
|
"delta": newRollupFuncOneArg(rollupDelta),
|
||||||
|
"deriv": newRollupFuncOneArg(rollupDerivSlow),
|
||||||
|
"deriv_fast": newRollupFuncOneArg(rollupDerivFast),
|
||||||
"descent_over_time": newRollupFuncOneArg(rollupDescentOverTime),
|
"descent_over_time": newRollupFuncOneArg(rollupDescentOverTime),
|
||||||
"zscore_over_time": newRollupFuncOneArg(rollupZScoreOverTime),
|
"distinct_over_time": newRollupFuncOneArg(rollupDistinct),
|
||||||
|
"duration_over_time": newRollupDurationOverTime,
|
||||||
|
"first_over_time": newRollupFuncOneArg(rollupFirst),
|
||||||
|
"geomean_over_time": newRollupFuncOneArg(rollupGeomean),
|
||||||
|
"histogram_over_time": newRollupFuncOneArg(rollupHistogram),
|
||||||
|
"hoeffding_bound_lower": newRollupHoeffdingBoundLower,
|
||||||
|
"hoeffding_bound_upper": newRollupHoeffdingBoundUpper,
|
||||||
|
"holt_winters": newRollupHoltWinters,
|
||||||
|
"idelta": newRollupFuncOneArg(rollupIdelta),
|
||||||
|
"ideriv": newRollupFuncOneArg(rollupIderiv),
|
||||||
|
"increase": newRollupFuncOneArg(rollupDelta), // + rollupFuncsRemoveCounterResets
|
||||||
|
"increase_pure": newRollupFuncOneArg(rollupIncreasePure), // + rollupFuncsRemoveCounterResets
|
||||||
|
"increases_over_time": newRollupFuncOneArg(rollupIncreases),
|
||||||
|
"integrate": newRollupFuncOneArg(rollupIntegrate),
|
||||||
|
"irate": newRollupFuncOneArg(rollupIderiv), // + rollupFuncsRemoveCounterResets
|
||||||
|
"lag": newRollupFuncOneArg(rollupLag),
|
||||||
|
"last_over_time": newRollupFuncOneArg(rollupLast),
|
||||||
|
"lifetime": newRollupFuncOneArg(rollupLifetime),
|
||||||
|
"max_over_time": newRollupFuncOneArg(rollupMax),
|
||||||
|
"min_over_time": newRollupFuncOneArg(rollupMin),
|
||||||
|
"mode_over_time": newRollupFuncOneArg(rollupModeOverTime),
|
||||||
|
"predict_linear": newRollupPredictLinear,
|
||||||
|
"present_over_time": newRollupFuncOneArg(rollupPresent),
|
||||||
|
"quantile_over_time": newRollupQuantile,
|
||||||
"quantiles_over_time": newRollupQuantiles,
|
"quantiles_over_time": newRollupQuantiles,
|
||||||
|
"range_over_time": newRollupFuncOneArg(rollupRange),
|
||||||
|
"rate": newRollupFuncOneArg(rollupDerivFast), // + rollupFuncsRemoveCounterResets
|
||||||
|
"rate_over_sum": newRollupFuncOneArg(rollupRateOverSum),
|
||||||
|
"resets": newRollupFuncOneArg(rollupResets),
|
||||||
|
"rollup": newRollupFuncOneArg(rollupFake),
|
||||||
|
"rollup_candlestick": newRollupFuncOneArg(rollupFake),
|
||||||
|
"rollup_delta": newRollupFuncOneArg(rollupFake),
|
||||||
|
"rollup_deriv": newRollupFuncOneArg(rollupFake),
|
||||||
|
"rollup_increase": newRollupFuncOneArg(rollupFake), // + rollupFuncsRemoveCounterResets
|
||||||
|
"rollup_rate": newRollupFuncOneArg(rollupFake), // + rollupFuncsRemoveCounterResets
|
||||||
|
"rollup_scrape_interval": newRollupFuncOneArg(rollupFake),
|
||||||
|
"scrape_interval": newRollupFuncOneArg(rollupScrapeInterval),
|
||||||
|
"share_gt_over_time": newRollupShareGT,
|
||||||
|
"share_le_over_time": newRollupShareLE,
|
||||||
|
"stddev_over_time": newRollupFuncOneArg(rollupStddev),
|
||||||
|
"stdvar_over_time": newRollupFuncOneArg(rollupStdvar),
|
||||||
|
"sum_over_time": newRollupFuncOneArg(rollupSum),
|
||||||
|
"sum2_over_time": newRollupFuncOneArg(rollupSum2),
|
||||||
|
"tfirst_over_time": newRollupFuncOneArg(rollupTfirst),
|
||||||
// `timestamp` function must return timestamp for the last datapoint on the current window
|
// `timestamp` function must return timestamp for the last datapoint on the current window
|
||||||
// in order to properly handle offset and timestamps unaligned to the current step.
|
// in order to properly handle offset and timestamps unaligned to the current step.
|
||||||
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415 for details.
|
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415 for details.
|
||||||
"timestamp": newRollupFuncOneArg(rollupTlast),
|
"timestamp": newRollupFuncOneArg(rollupTlast),
|
||||||
|
"tlast_over_time": newRollupFuncOneArg(rollupTlast),
|
||||||
// See https://en.wikipedia.org/wiki/Mode_(statistics)
|
"tmax_over_time": newRollupFuncOneArg(rollupTmax),
|
||||||
"mode_over_time": newRollupFuncOneArg(rollupModeOverTime),
|
"tmin_over_time": newRollupFuncOneArg(rollupTmin),
|
||||||
|
"zscore_over_time": newRollupFuncOneArg(rollupZScoreOverTime),
|
||||||
"rate_over_sum": newRollupFuncOneArg(rollupRateOverSum),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// rollupAggrFuncs are functions that can be passed to `aggr_over_time()`
|
// rollupAggrFuncs are functions that can be passed to `aggr_over_time()`
|
||||||
var rollupAggrFuncs = map[string]rollupFunc{
|
var rollupAggrFuncs = map[string]rollupFunc{
|
||||||
// Standard rollup funcs from PromQL.
|
"absent_over_time": rollupAbsent,
|
||||||
"changes": rollupChanges,
|
|
||||||
"delta": rollupDelta,
|
|
||||||
"deriv": rollupDerivSlow,
|
|
||||||
"deriv_fast": rollupDerivFast,
|
|
||||||
"idelta": rollupIdelta,
|
|
||||||
"increase": rollupDelta, // + rollupFuncsRemoveCounterResets
|
|
||||||
"irate": rollupIderiv, // + rollupFuncsRemoveCounterResets
|
|
||||||
"rate": rollupDerivFast, // + rollupFuncsRemoveCounterResets
|
|
||||||
"resets": rollupResets,
|
|
||||||
"avg_over_time": rollupAvg,
|
|
||||||
"min_over_time": rollupMin,
|
|
||||||
"max_over_time": rollupMax,
|
|
||||||
"sum_over_time": rollupSum,
|
|
||||||
"count_over_time": rollupCount,
|
|
||||||
"stddev_over_time": rollupStddev,
|
|
||||||
"stdvar_over_time": rollupStdvar,
|
|
||||||
"absent_over_time": rollupAbsent,
|
|
||||||
"present_over_time": rollupPresent,
|
|
||||||
|
|
||||||
// Additional rollup funcs.
|
|
||||||
"range_over_time": rollupRange,
|
|
||||||
"sum2_over_time": rollupSum2,
|
|
||||||
"geomean_over_time": rollupGeomean,
|
|
||||||
"first_over_time": rollupFirst,
|
|
||||||
"last_over_time": rollupLast,
|
|
||||||
"distinct_over_time": rollupDistinct,
|
|
||||||
"increases_over_time": rollupIncreases,
|
|
||||||
"decreases_over_time": rollupDecreases,
|
|
||||||
"increase_pure": rollupIncreasePure,
|
|
||||||
"integrate": rollupIntegrate,
|
|
||||||
"ideriv": rollupIderiv,
|
|
||||||
"lifetime": rollupLifetime,
|
|
||||||
"lag": rollupLag,
|
|
||||||
"scrape_interval": rollupScrapeInterval,
|
|
||||||
"tmin_over_time": rollupTmin,
|
|
||||||
"tmax_over_time": rollupTmax,
|
|
||||||
"tfirst_over_time": rollupTfirst,
|
|
||||||
"tlast_over_time": rollupTlast,
|
|
||||||
"ascent_over_time": rollupAscentOverTime,
|
"ascent_over_time": rollupAscentOverTime,
|
||||||
|
"avg_over_time": rollupAvg,
|
||||||
|
"changes": rollupChanges,
|
||||||
|
"count_over_time": rollupCount,
|
||||||
|
"decreases_over_time": rollupDecreases,
|
||||||
|
"default_rollup": rollupDefault,
|
||||||
|
"delta": rollupDelta,
|
||||||
|
"deriv": rollupDerivSlow,
|
||||||
|
"deriv_fast": rollupDerivFast,
|
||||||
"descent_over_time": rollupDescentOverTime,
|
"descent_over_time": rollupDescentOverTime,
|
||||||
"zscore_over_time": rollupZScoreOverTime,
|
"distinct_over_time": rollupDistinct,
|
||||||
"timestamp": rollupTlast,
|
"first_over_time": rollupFirst,
|
||||||
|
"geomean_over_time": rollupGeomean,
|
||||||
|
"idelta": rollupIdelta,
|
||||||
|
"ideriv": rollupIderiv,
|
||||||
|
"increase": rollupDelta,
|
||||||
|
"increase_pure": rollupIncreasePure,
|
||||||
|
"increases_over_time": rollupIncreases,
|
||||||
|
"integrate": rollupIntegrate,
|
||||||
|
"irate": rollupIderiv,
|
||||||
|
"lag": rollupLag,
|
||||||
|
"last_over_time": rollupLast,
|
||||||
|
"lifetime": rollupLifetime,
|
||||||
|
"max_over_time": rollupMax,
|
||||||
|
"min_over_time": rollupMin,
|
||||||
"mode_over_time": rollupModeOverTime,
|
"mode_over_time": rollupModeOverTime,
|
||||||
|
"present_over_time": rollupPresent,
|
||||||
|
"range_over_time": rollupRange,
|
||||||
|
"rate": rollupDerivFast,
|
||||||
"rate_over_sum": rollupRateOverSum,
|
"rate_over_sum": rollupRateOverSum,
|
||||||
|
"resets": rollupResets,
|
||||||
|
"scrape_interval": rollupScrapeInterval,
|
||||||
|
"stddev_over_time": rollupStddev,
|
||||||
|
"stdvar_over_time": rollupStdvar,
|
||||||
|
"sum_over_time": rollupSum,
|
||||||
|
"sum2_over_time": rollupSum2,
|
||||||
|
"tfirst_over_time": rollupTfirst,
|
||||||
|
"timestamp": rollupTlast,
|
||||||
|
"tlast_over_time": rollupTlast,
|
||||||
|
"tmax_over_time": rollupTmax,
|
||||||
|
"tmin_over_time": rollupTmin,
|
||||||
|
"zscore_over_time": rollupZScoreOverTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
// VictoriaMetrics can increase lookbehind window in square brackets for these functions
|
// VictoriaMetrics can increase lookbehind window in square brackets for these functions
|
||||||
|
@ -170,29 +160,31 @@ var rollupFuncsCanAdjustWindow = map[string]bool{
|
||||||
|
|
||||||
var rollupFuncsRemoveCounterResets = map[string]bool{
|
var rollupFuncsRemoveCounterResets = map[string]bool{
|
||||||
"increase": true,
|
"increase": true,
|
||||||
|
"increase_pure": true,
|
||||||
"irate": true,
|
"irate": true,
|
||||||
"rate": true,
|
"rate": true,
|
||||||
"rollup_rate": true,
|
|
||||||
"rollup_increase": true,
|
"rollup_increase": true,
|
||||||
"increase_pure": true,
|
"rollup_rate": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These functions don't change physical meaning of input time series,
|
||||||
|
// so they don't drop metric name
|
||||||
var rollupFuncsKeepMetricGroup = map[string]bool{
|
var rollupFuncsKeepMetricGroup = map[string]bool{
|
||||||
"holt_winters": true,
|
|
||||||
"predict_linear": true,
|
|
||||||
"default_rollup": true,
|
|
||||||
"avg_over_time": true,
|
"avg_over_time": true,
|
||||||
"min_over_time": true,
|
"default_rollup": true,
|
||||||
"max_over_time": true,
|
"first_over_time": true,
|
||||||
"quantile_over_time": true,
|
|
||||||
"quantiles_over_time": true,
|
|
||||||
"rollup": true,
|
|
||||||
"geomean_over_time": true,
|
"geomean_over_time": true,
|
||||||
"hoeffding_bound_lower": true,
|
"hoeffding_bound_lower": true,
|
||||||
"hoeffding_bound_upper": true,
|
"hoeffding_bound_upper": true,
|
||||||
"first_over_time": true,
|
"holt_winters": true,
|
||||||
"last_over_time": true,
|
"last_over_time": true,
|
||||||
|
"max_over_time": true,
|
||||||
|
"min_over_time": true,
|
||||||
"mode_over_time": true,
|
"mode_over_time": true,
|
||||||
|
"predict_linear": true,
|
||||||
|
"quantile_over_time": true,
|
||||||
|
"quantiles_over_time": true,
|
||||||
|
"rollup": true,
|
||||||
"rollup_candlestick": true,
|
"rollup_candlestick": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,131 +17,128 @@ import (
|
||||||
"github.com/VictoriaMetrics/metricsql"
|
"github.com/VictoriaMetrics/metricsql"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var transformFuncs = map[string]transformFunc{
|
||||||
|
"": transformUnion, // empty func is a synonym to union
|
||||||
|
"abs": newTransformFuncOneArg(transformAbs),
|
||||||
|
"absent": transformAbsent,
|
||||||
|
"acos": newTransformFuncOneArg(transformAcos),
|
||||||
|
"acosh": newTransformFuncOneArg(transformAcosh),
|
||||||
|
"asin": newTransformFuncOneArg(transformAsin),
|
||||||
|
"asinh": newTransformFuncOneArg(transformAsinh),
|
||||||
|
"atan": newTransformFuncOneArg(transformAtan),
|
||||||
|
"atanh": newTransformFuncOneArg(transformAtanh),
|
||||||
|
"bitmap_and": newTransformBitmap(bitmapAnd),
|
||||||
|
"bitmap_or": newTransformBitmap(bitmapOr),
|
||||||
|
"bitmap_xor": newTransformBitmap(bitmapXor),
|
||||||
|
"buckets_limit": transformBucketsLimit,
|
||||||
|
"ceil": newTransformFuncOneArg(transformCeil),
|
||||||
|
"clamp": transformClamp,
|
||||||
|
"clamp_max": transformClampMax,
|
||||||
|
"clamp_min": transformClampMin,
|
||||||
|
"cos": newTransformFuncOneArg(transformCos),
|
||||||
|
"cosh": newTransformFuncOneArg(transformCosh),
|
||||||
|
"day_of_month": newTransformFuncDateTime(transformDayOfMonth),
|
||||||
|
"day_of_week": newTransformFuncDateTime(transformDayOfWeek),
|
||||||
|
"days_in_month": newTransformFuncDateTime(transformDaysInMonth),
|
||||||
|
"deg": newTransformFuncOneArg(transformDeg),
|
||||||
|
"end": newTransformFuncZeroArgs(transformEnd),
|
||||||
|
"exp": newTransformFuncOneArg(transformExp),
|
||||||
|
"floor": newTransformFuncOneArg(transformFloor),
|
||||||
|
"histogram_avg": transformHistogramAvg,
|
||||||
|
"histogram_quantile": transformHistogramQuantile,
|
||||||
|
"histogram_quantiles": transformHistogramQuantiles,
|
||||||
|
"histogram_share": transformHistogramShare,
|
||||||
|
"histogram_stddev": transformHistogramStddev,
|
||||||
|
"histogram_stdvar": transformHistogramStdvar,
|
||||||
|
"hour": newTransformFuncDateTime(transformHour),
|
||||||
|
"interpolate": transformInterpolate,
|
||||||
|
"keep_last_value": transformKeepLastValue,
|
||||||
|
"keep_next_value": transformKeepNextValue,
|
||||||
|
"label_copy": transformLabelCopy,
|
||||||
|
"label_del": transformLabelDel,
|
||||||
|
"label_graphite_group": transformLabelGraphiteGroup,
|
||||||
|
"label_join": transformLabelJoin,
|
||||||
|
"label_keep": transformLabelKeep,
|
||||||
|
"label_lowercase": transformLabelLowercase,
|
||||||
|
"label_map": transformLabelMap,
|
||||||
|
"label_match": transformLabelMatch,
|
||||||
|
"label_mismatch": transformLabelMismatch,
|
||||||
|
"label_move": transformLabelMove,
|
||||||
|
"label_replace": transformLabelReplace,
|
||||||
|
"label_set": transformLabelSet,
|
||||||
|
"label_transform": transformLabelTransform,
|
||||||
|
"label_uppercase": transformLabelUppercase,
|
||||||
|
"label_value": transformLabelValue,
|
||||||
|
"ln": newTransformFuncOneArg(transformLn),
|
||||||
|
"log2": newTransformFuncOneArg(transformLog2),
|
||||||
|
"log10": newTransformFuncOneArg(transformLog10),
|
||||||
|
"minute": newTransformFuncDateTime(transformMinute),
|
||||||
|
"month": newTransformFuncDateTime(transformMonth),
|
||||||
|
"pi": transformPi,
|
||||||
|
"prometheus_buckets": transformPrometheusBuckets,
|
||||||
|
"rad": newTransformFuncOneArg(transformRad),
|
||||||
|
"rand": newTransformRand(newRandFloat64),
|
||||||
|
"rand_exponential": newTransformRand(newRandExpFloat64),
|
||||||
|
"rand_normal": newTransformRand(newRandNormFloat64),
|
||||||
|
"range_avg": newTransformFuncRange(runningAvg),
|
||||||
|
"range_first": transformRangeFirst,
|
||||||
|
"range_last": transformRangeLast,
|
||||||
|
"range_max": newTransformFuncRange(runningMax),
|
||||||
|
"range_min": newTransformFuncRange(runningMin),
|
||||||
|
"range_quantile": transformRangeQuantile,
|
||||||
|
"range_sum": newTransformFuncRange(runningSum),
|
||||||
|
"remove_resets": transformRemoveResets,
|
||||||
|
"round": transformRound,
|
||||||
|
"running_avg": newTransformFuncRunning(runningAvg),
|
||||||
|
"running_max": newTransformFuncRunning(runningMax),
|
||||||
|
"running_min": newTransformFuncRunning(runningMin),
|
||||||
|
"running_sum": newTransformFuncRunning(runningSum),
|
||||||
|
"scalar": transformScalar,
|
||||||
|
"sgn": transformSgn,
|
||||||
|
"sin": newTransformFuncOneArg(transformSin),
|
||||||
|
"sinh": newTransformFuncOneArg(transformSinh),
|
||||||
|
"smooth_exponential": transformSmoothExponential,
|
||||||
|
"sort": newTransformFuncSort(false),
|
||||||
|
"sort_by_label": newTransformFuncSortByLabel(false),
|
||||||
|
"sort_by_label_desc": newTransformFuncSortByLabel(true),
|
||||||
|
"sort_desc": newTransformFuncSort(true),
|
||||||
|
"sqrt": newTransformFuncOneArg(transformSqrt),
|
||||||
|
"start": newTransformFuncZeroArgs(transformStart),
|
||||||
|
"step": newTransformFuncZeroArgs(transformStep),
|
||||||
|
"tan": newTransformFuncOneArg(transformTan),
|
||||||
|
"tanh": newTransformFuncOneArg(transformTanh),
|
||||||
|
"time": transformTime,
|
||||||
|
// "timestamp" has been moved to rollup funcs. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415
|
||||||
|
"timezone_offset": transformTimezoneOffset,
|
||||||
|
"union": transformUnion,
|
||||||
|
"vector": transformVector,
|
||||||
|
"year": newTransformFuncDateTime(transformYear),
|
||||||
|
}
|
||||||
|
|
||||||
|
// These functions don't change physical meaning of input time series,
|
||||||
|
// so they don't drop metric name
|
||||||
var transformFuncsKeepMetricGroup = map[string]bool{
|
var transformFuncsKeepMetricGroup = map[string]bool{
|
||||||
"ceil": true,
|
"ceil": true,
|
||||||
"clamp": true,
|
"clamp": true,
|
||||||
"clamp_max": true,
|
"clamp_max": true,
|
||||||
"clamp_min": true,
|
"clamp_min": true,
|
||||||
"floor": true,
|
"floor": true,
|
||||||
"round": true,
|
"interpolate": true,
|
||||||
"keep_last_value": true,
|
"keep_last_value": true,
|
||||||
"keep_next_value": true,
|
"keep_next_value": true,
|
||||||
"interpolate": true,
|
|
||||||
"running_min": true,
|
|
||||||
"running_max": true,
|
|
||||||
"running_avg": true,
|
|
||||||
"range_min": true,
|
|
||||||
"range_max": true,
|
|
||||||
"range_avg": true,
|
"range_avg": true,
|
||||||
"range_first": true,
|
"range_first": true,
|
||||||
"range_last": true,
|
"range_last": true,
|
||||||
|
"range_max": true,
|
||||||
|
"range_min": true,
|
||||||
"range_quantile": true,
|
"range_quantile": true,
|
||||||
|
"round": true,
|
||||||
|
"running_avg": true,
|
||||||
|
"running_max": true,
|
||||||
|
"running_min": true,
|
||||||
"smooth_exponential": true,
|
"smooth_exponential": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
var transformFuncs = map[string]transformFunc{
|
|
||||||
// Standard promql funcs
|
|
||||||
// See funcs accepting instant-vector on https://prometheus.io/docs/prometheus/latest/querying/functions/ .
|
|
||||||
"abs": newTransformFuncOneArg(transformAbs),
|
|
||||||
"absent": transformAbsent,
|
|
||||||
"acos": newTransformFuncOneArg(transformAcos),
|
|
||||||
"acosh": newTransformFuncOneArg(transformAcosh),
|
|
||||||
"asin": newTransformFuncOneArg(transformAsin),
|
|
||||||
"asinh": newTransformFuncOneArg(transformAsinh),
|
|
||||||
"atan": newTransformFuncOneArg(transformAtan),
|
|
||||||
"atanh": newTransformFuncOneArg(transformAtanh),
|
|
||||||
"ceil": newTransformFuncOneArg(transformCeil),
|
|
||||||
"clamp": transformClamp,
|
|
||||||
"clamp_max": transformClampMax,
|
|
||||||
"clamp_min": transformClampMin,
|
|
||||||
"cos": newTransformFuncOneArg(transformCos),
|
|
||||||
"cosh": newTransformFuncOneArg(transformCosh),
|
|
||||||
"day_of_month": newTransformFuncDateTime(transformDayOfMonth),
|
|
||||||
"day_of_week": newTransformFuncDateTime(transformDayOfWeek),
|
|
||||||
"days_in_month": newTransformFuncDateTime(transformDaysInMonth),
|
|
||||||
"deg": newTransformFuncOneArg(transformDeg),
|
|
||||||
"exp": newTransformFuncOneArg(transformExp),
|
|
||||||
"floor": newTransformFuncOneArg(transformFloor),
|
|
||||||
"histogram_quantile": transformHistogramQuantile,
|
|
||||||
"hour": newTransformFuncDateTime(transformHour),
|
|
||||||
"label_join": transformLabelJoin,
|
|
||||||
"label_replace": transformLabelReplace,
|
|
||||||
"ln": newTransformFuncOneArg(transformLn),
|
|
||||||
"log2": newTransformFuncOneArg(transformLog2),
|
|
||||||
"log10": newTransformFuncOneArg(transformLog10),
|
|
||||||
"minute": newTransformFuncDateTime(transformMinute),
|
|
||||||
"month": newTransformFuncDateTime(transformMonth),
|
|
||||||
"pi": transformPi,
|
|
||||||
"rad": newTransformFuncOneArg(transformRad),
|
|
||||||
"round": transformRound,
|
|
||||||
"scalar": transformScalar,
|
|
||||||
"sgn": transformSgn,
|
|
||||||
"sin": newTransformFuncOneArg(transformSin),
|
|
||||||
"sinh": newTransformFuncOneArg(transformSinh),
|
|
||||||
"sort": newTransformFuncSort(false),
|
|
||||||
"sort_desc": newTransformFuncSort(true),
|
|
||||||
"sqrt": newTransformFuncOneArg(transformSqrt),
|
|
||||||
"tan": newTransformFuncOneArg(transformTan),
|
|
||||||
"tanh": newTransformFuncOneArg(transformTanh),
|
|
||||||
"time": transformTime,
|
|
||||||
// "timestamp" has been moved to rollup funcs. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415
|
|
||||||
"vector": transformVector,
|
|
||||||
"year": newTransformFuncDateTime(transformYear),
|
|
||||||
|
|
||||||
// New funcs
|
|
||||||
"label_set": transformLabelSet,
|
|
||||||
"label_map": transformLabelMap,
|
|
||||||
"label_uppercase": transformLabelUppercase,
|
|
||||||
"label_lowercase": transformLabelLowercase,
|
|
||||||
"label_del": transformLabelDel,
|
|
||||||
"label_keep": transformLabelKeep,
|
|
||||||
"label_copy": transformLabelCopy,
|
|
||||||
"label_move": transformLabelMove,
|
|
||||||
"label_transform": transformLabelTransform,
|
|
||||||
"label_value": transformLabelValue,
|
|
||||||
"label_match": transformLabelMatch,
|
|
||||||
"label_mismatch": transformLabelMismatch,
|
|
||||||
"label_graphite_group": transformLabelGraphiteGroup,
|
|
||||||
|
|
||||||
"union": transformUnion,
|
|
||||||
"": transformUnion, // empty func is a synonym to union
|
|
||||||
"keep_last_value": transformKeepLastValue,
|
|
||||||
"keep_next_value": transformKeepNextValue,
|
|
||||||
"interpolate": transformInterpolate,
|
|
||||||
"start": newTransformFuncZeroArgs(transformStart),
|
|
||||||
"end": newTransformFuncZeroArgs(transformEnd),
|
|
||||||
"step": newTransformFuncZeroArgs(transformStep),
|
|
||||||
"running_sum": newTransformFuncRunning(runningSum),
|
|
||||||
"running_max": newTransformFuncRunning(runningMax),
|
|
||||||
"running_min": newTransformFuncRunning(runningMin),
|
|
||||||
"running_avg": newTransformFuncRunning(runningAvg),
|
|
||||||
"range_sum": newTransformFuncRange(runningSum),
|
|
||||||
"range_max": newTransformFuncRange(runningMax),
|
|
||||||
"range_min": newTransformFuncRange(runningMin),
|
|
||||||
"range_avg": newTransformFuncRange(runningAvg),
|
|
||||||
"range_first": transformRangeFirst,
|
|
||||||
"range_last": transformRangeLast,
|
|
||||||
"range_quantile": transformRangeQuantile,
|
|
||||||
"smooth_exponential": transformSmoothExponential,
|
|
||||||
"remove_resets": transformRemoveResets,
|
|
||||||
"rand": newTransformRand(newRandFloat64),
|
|
||||||
"rand_normal": newTransformRand(newRandNormFloat64),
|
|
||||||
"rand_exponential": newTransformRand(newRandExpFloat64),
|
|
||||||
"prometheus_buckets": transformPrometheusBuckets,
|
|
||||||
"buckets_limit": transformBucketsLimit,
|
|
||||||
"histogram_share": transformHistogramShare,
|
|
||||||
"histogram_avg": transformHistogramAvg,
|
|
||||||
"histogram_stdvar": transformHistogramStdvar,
|
|
||||||
"histogram_stddev": transformHistogramStddev,
|
|
||||||
"sort_by_label": newTransformFuncSortByLabel(false),
|
|
||||||
"sort_by_label_desc": newTransformFuncSortByLabel(true),
|
|
||||||
"timezone_offset": transformTimezoneOffset,
|
|
||||||
"bitmap_and": newTransformBitmap(bitmapAnd),
|
|
||||||
"bitmap_or": newTransformBitmap(bitmapOr),
|
|
||||||
"bitmap_xor": newTransformBitmap(bitmapXor),
|
|
||||||
"histogram_quantiles": transformHistogramQuantiles,
|
|
||||||
}
|
|
||||||
|
|
||||||
func getTransformFunc(s string) transformFunc {
|
func getTransformFunc(s string) transformFunc {
|
||||||
s = strings.ToLower(s)
|
s = strings.ToLower(s)
|
||||||
return transformFuncs[s]
|
return transformFuncs[s]
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -8,7 +8,7 @@ require (
|
||||||
// like https://github.com/valyala/fasthttp/commit/996610f021ff45fdc98c2ce7884d5fa4e7f9199b
|
// like https://github.com/valyala/fasthttp/commit/996610f021ff45fdc98c2ce7884d5fa4e7f9199b
|
||||||
github.com/VictoriaMetrics/fasthttp v1.1.0
|
github.com/VictoriaMetrics/fasthttp v1.1.0
|
||||||
github.com/VictoriaMetrics/metrics v1.18.1
|
github.com/VictoriaMetrics/metrics v1.18.1
|
||||||
github.com/VictoriaMetrics/metricsql v0.30.0
|
github.com/VictoriaMetrics/metricsql v0.30.1
|
||||||
github.com/VividCortex/ewma v1.2.0 // indirect
|
github.com/VividCortex/ewma v1.2.0 // indirect
|
||||||
github.com/aws/aws-sdk-go v1.41.19
|
github.com/aws/aws-sdk-go v1.41.19
|
||||||
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
|
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -108,8 +108,8 @@ github.com/VictoriaMetrics/fasthttp v1.1.0/go.mod h1:/7DMcogqd+aaD3G3Hg5kFgoFwlR
|
||||||
github.com/VictoriaMetrics/metrics v1.12.2/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE=
|
github.com/VictoriaMetrics/metrics v1.12.2/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE=
|
||||||
github.com/VictoriaMetrics/metrics v1.18.1 h1:OZ0+kTTto8oPfHnVAnTOoyl0XlRhRkoQrD2n2cOuRw0=
|
github.com/VictoriaMetrics/metrics v1.18.1 h1:OZ0+kTTto8oPfHnVAnTOoyl0XlRhRkoQrD2n2cOuRw0=
|
||||||
github.com/VictoriaMetrics/metrics v1.18.1/go.mod h1:ArjwVz7WpgpegX/JpB0zpNF2h2232kErkEnzH1sxMmA=
|
github.com/VictoriaMetrics/metrics v1.18.1/go.mod h1:ArjwVz7WpgpegX/JpB0zpNF2h2232kErkEnzH1sxMmA=
|
||||||
github.com/VictoriaMetrics/metricsql v0.30.0 h1:MGLqMcnVU2PTg+eOhqxpizQni6YwsYPbfv7rsHs+kU0=
|
github.com/VictoriaMetrics/metricsql v0.30.1 h1:WFRNNocJsU6h98f7fkthHkMH1xwmcVSP2eSAap9FpTc=
|
||||||
github.com/VictoriaMetrics/metricsql v0.30.0/go.mod h1:ylO7YITho/Iw6P71oEaGyHbO94bGoGtzWfLGqFhMIg8=
|
github.com/VictoriaMetrics/metricsql v0.30.1/go.mod h1:ylO7YITho/Iw6P71oEaGyHbO94bGoGtzWfLGqFhMIg8=
|
||||||
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
|
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
|
||||||
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
|
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
|
||||||
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
|
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
|
||||||
|
|
61
vendor/github.com/VictoriaMetrics/metricsql/aggr.go
generated
vendored
61
vendor/github.com/VictoriaMetrics/metricsql/aggr.go
generated
vendored
|
@ -5,45 +5,42 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var aggrFuncs = map[string]bool{
|
var aggrFuncs = map[string]bool{
|
||||||
// See https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
|
"any": true,
|
||||||
"sum": true,
|
"avg": true,
|
||||||
"min": true,
|
"bottomk": true,
|
||||||
"max": true,
|
|
||||||
"avg": true,
|
|
||||||
"stddev": true,
|
|
||||||
"stdvar": true,
|
|
||||||
"count": true,
|
|
||||||
"count_values": true,
|
|
||||||
"bottomk": true,
|
|
||||||
"topk": true,
|
|
||||||
"quantile": true,
|
|
||||||
"group": true,
|
|
||||||
|
|
||||||
// MetricsQL extension funcs
|
|
||||||
"median": true,
|
|
||||||
"limitk": true,
|
|
||||||
"limit_offset": true,
|
|
||||||
"distinct": true,
|
|
||||||
"sum2": true,
|
|
||||||
"geomean": true,
|
|
||||||
"histogram": true,
|
|
||||||
"topk_min": true,
|
|
||||||
"topk_max": true,
|
|
||||||
"topk_avg": true,
|
|
||||||
"topk_median": true,
|
|
||||||
"topk_last": true,
|
|
||||||
"bottomk_min": true,
|
|
||||||
"bottomk_max": true,
|
|
||||||
"bottomk_avg": true,
|
"bottomk_avg": true,
|
||||||
|
"bottomk_max": true,
|
||||||
"bottomk_median": true,
|
"bottomk_median": true,
|
||||||
"bottomk_last": true,
|
"bottomk_last": true,
|
||||||
"any": true,
|
"bottomk_min": true,
|
||||||
|
"count": true,
|
||||||
|
"count_values": true,
|
||||||
|
"distinct": true,
|
||||||
|
"geomean": true,
|
||||||
|
"group": true,
|
||||||
|
"histogram": true,
|
||||||
|
"limit_offset": true,
|
||||||
|
"limitk": true,
|
||||||
"mad": true,
|
"mad": true,
|
||||||
|
"max": true,
|
||||||
|
"median": true,
|
||||||
|
"min": true,
|
||||||
|
"mode": true,
|
||||||
"outliers_mad": true,
|
"outliers_mad": true,
|
||||||
"outliersk": true,
|
"outliersk": true,
|
||||||
"mode": true,
|
"quantile": true,
|
||||||
"zscore": true,
|
|
||||||
"quantiles": true,
|
"quantiles": true,
|
||||||
|
"stddev": true,
|
||||||
|
"stdvar": true,
|
||||||
|
"sum": true,
|
||||||
|
"sum2": true,
|
||||||
|
"topk": true,
|
||||||
|
"topk_avg": true,
|
||||||
|
"topk_max": true,
|
||||||
|
"topk_median": true,
|
||||||
|
"topk_last": true,
|
||||||
|
"topk_min": true,
|
||||||
|
"zscore": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
func isAggrFunc(s string) bool {
|
func isAggrFunc(s string) bool {
|
||||||
|
|
133
vendor/github.com/VictoriaMetrics/metricsql/rollup.go
generated
vendored
133
vendor/github.com/VictoriaMetrics/metricsql/rollup.go
generated
vendored
|
@ -5,81 +5,74 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var rollupFuncs = map[string]bool{
|
var rollupFuncs = map[string]bool{
|
||||||
// Standard rollup funcs from PromQL.
|
"absent_over_time": true,
|
||||||
// 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,
|
|
||||||
"absent_over_time": true,
|
|
||||||
"present_over_time": true,
|
|
||||||
"last_over_time": true,
|
|
||||||
|
|
||||||
// Additional rollup funcs.
|
|
||||||
"default_rollup": true,
|
|
||||||
"range_over_time": true,
|
|
||||||
"sum2_over_time": true,
|
|
||||||
"geomean_over_time": true,
|
|
||||||
"first_over_time": true,
|
|
||||||
"distinct_over_time": true,
|
|
||||||
"increases_over_time": true,
|
|
||||||
"decreases_over_time": true,
|
|
||||||
"increase_pure": true,
|
|
||||||
"integrate": true,
|
|
||||||
"ideriv": true,
|
|
||||||
"lifetime": true,
|
|
||||||
"lag": true,
|
|
||||||
"scrape_interval": true,
|
|
||||||
"tmin_over_time": true,
|
|
||||||
"tmax_over_time": true,
|
|
||||||
"tfirst_over_time": true,
|
|
||||||
"tlast_over_time": true,
|
|
||||||
"duration_over_time": true,
|
|
||||||
"share_le_over_time": true,
|
|
||||||
"share_gt_over_time": true,
|
|
||||||
"count_le_over_time": true,
|
|
||||||
"count_gt_over_time": true,
|
|
||||||
"count_eq_over_time": true,
|
|
||||||
"count_ne_over_time": true,
|
|
||||||
"histogram_over_time": true,
|
|
||||||
"rollup": true,
|
|
||||||
"rollup_rate": true,
|
|
||||||
"rollup_deriv": true,
|
|
||||||
"rollup_delta": true,
|
|
||||||
"rollup_increase": true,
|
|
||||||
"rollup_candlestick": true,
|
|
||||||
"rollup_scrape_interval": true,
|
|
||||||
"aggr_over_time": true,
|
"aggr_over_time": true,
|
||||||
"hoeffding_bound_upper": true,
|
|
||||||
"hoeffding_bound_lower": true,
|
|
||||||
"ascent_over_time": true,
|
"ascent_over_time": true,
|
||||||
|
"avg_over_time": true,
|
||||||
|
"changes": true,
|
||||||
|
"count_eq_over_time": true,
|
||||||
|
"count_gt_over_time": true,
|
||||||
|
"count_le_over_time": true,
|
||||||
|
"count_ne_over_time": true,
|
||||||
|
"count_over_time": true,
|
||||||
|
"decreases_over_time": true,
|
||||||
|
"default_rollup": true,
|
||||||
|
"delta": true,
|
||||||
|
"deriv": true,
|
||||||
|
"deriv_fast": true,
|
||||||
"descent_over_time": true,
|
"descent_over_time": true,
|
||||||
"zscore_over_time": true,
|
"distinct_over_time": true,
|
||||||
|
"duration_over_time": true,
|
||||||
|
"first_over_time": true,
|
||||||
|
"geomean_over_time": true,
|
||||||
|
"histogram_over_time": true,
|
||||||
|
"hoeffding_bound_lower": true,
|
||||||
|
"hoeffding_bound_upper": true,
|
||||||
|
"holt_winters": true,
|
||||||
|
"idelta": true,
|
||||||
|
"ideriv": true,
|
||||||
|
"increase": true,
|
||||||
|
"increase_pure": true,
|
||||||
|
"increases_over_time": true,
|
||||||
|
"integrate": true,
|
||||||
|
"irate": true,
|
||||||
|
"lag": true,
|
||||||
|
"last_over_time": true,
|
||||||
|
"lifetime": true,
|
||||||
|
"max_over_time": true,
|
||||||
|
"min_over_time": true,
|
||||||
|
"mode_over_time": true,
|
||||||
|
"predict_linear": true,
|
||||||
|
"present_over_time": true,
|
||||||
|
"quantile_over_time": true,
|
||||||
"quantiles_over_time": true,
|
"quantiles_over_time": true,
|
||||||
|
"range_over_time": true,
|
||||||
// `timestamp` func has been moved here because it must work properly with offsets and samples unaligned to the current step.
|
"rate": true,
|
||||||
|
"rate_over_sum": true,
|
||||||
|
"resets": true,
|
||||||
|
"rollup": true,
|
||||||
|
"rollup_candlestick": true,
|
||||||
|
"rollup_delta": true,
|
||||||
|
"rollup_deriv": true,
|
||||||
|
"rollup_increase": true,
|
||||||
|
"rollup_rate": true,
|
||||||
|
"rollup_scrape_interval": true,
|
||||||
|
"scrape_interval": true,
|
||||||
|
"share_gt_over_time": true,
|
||||||
|
"share_le_over_time": true,
|
||||||
|
"stddev_over_time": true,
|
||||||
|
"stdvar_over_time": true,
|
||||||
|
"sum_over_time": true,
|
||||||
|
"sum2_over_time": true,
|
||||||
|
"tfirst_over_time": true,
|
||||||
|
// `timestamp` function must return timestamp for the last datapoint on the current window
|
||||||
|
// in order to properly handle offset and timestamps unaligned to the current step.
|
||||||
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415 for details.
|
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415 for details.
|
||||||
"timestamp": true,
|
"timestamp": true,
|
||||||
|
"tlast_over_time": true,
|
||||||
// See https://en.wikipedia.org/wiki/Mode_(statistics)
|
"tmax_over_time": true,
|
||||||
"mode_over_time": true,
|
"tmin_over_time": true,
|
||||||
|
"zscore_over_time": true,
|
||||||
"rate_over_sum": true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsRollupFunc returns whether funcName is known rollup function.
|
// IsRollupFunc returns whether funcName is known rollup function.
|
||||||
|
|
189
vendor/github.com/VictoriaMetrics/metricsql/transform.go
generated
vendored
189
vendor/github.com/VictoriaMetrics/metricsql/transform.go
generated
vendored
|
@ -5,106 +5,101 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var transformFuncs = map[string]bool{
|
var transformFuncs = map[string]bool{
|
||||||
// Standard promql funcs
|
"": true, // empty func is a synonym to union
|
||||||
// See funcs accepting instant-vector on https://prometheus.io/docs/prometheus/latest/querying/functions/ .
|
"abs": true,
|
||||||
"abs": true,
|
"absent": true,
|
||||||
"absent": true,
|
"acos": true,
|
||||||
"acos": true,
|
"acosh": true,
|
||||||
"acosh": true,
|
"asin": true,
|
||||||
"asin": true,
|
"asinh": true,
|
||||||
"asinh": true,
|
"atan": true,
|
||||||
"atan": true,
|
"atanh": true,
|
||||||
"atanh": true,
|
"bitmap_and": true,
|
||||||
"ceil": true,
|
"bitmap_or": true,
|
||||||
"clamp": true,
|
"bitmap_xor": true,
|
||||||
"clamp_max": true,
|
"buckets_limit": true,
|
||||||
"clamp_min": true,
|
"ceil": true,
|
||||||
"cos": true,
|
"clamp": true,
|
||||||
"cosh": true,
|
"clamp_max": true,
|
||||||
"day_of_month": true,
|
"clamp_min": true,
|
||||||
"day_of_week": true,
|
"cos": true,
|
||||||
"days_in_month": true,
|
"cosh": true,
|
||||||
"deg": true,
|
"day_of_month": true,
|
||||||
"exp": true,
|
"day_of_week": true,
|
||||||
"floor": true,
|
"days_in_month": true,
|
||||||
"histogram_quantile": true,
|
"deg": true,
|
||||||
"hour": true,
|
"end": true,
|
||||||
"label_join": true,
|
"exp": true,
|
||||||
"label_replace": true,
|
"floor": true,
|
||||||
"ln": true,
|
"histogram_avg": true,
|
||||||
"log2": true,
|
"histogram_quantile": true,
|
||||||
"log10": true,
|
"histogram_quantiles": true,
|
||||||
"minute": true,
|
"histogram_share": true,
|
||||||
"month": true,
|
"histogram_stddev": true,
|
||||||
"pi": true,
|
"histogram_stdvar": true,
|
||||||
"rad": true,
|
"hour": true,
|
||||||
"round": true,
|
"interpolate": true,
|
||||||
"scalar": true,
|
"keep_last_value": true,
|
||||||
"sgn": true,
|
"keep_next_value": true,
|
||||||
"sin": true,
|
|
||||||
"sinh": true,
|
|
||||||
"sort": true,
|
|
||||||
"sort_desc": true,
|
|
||||||
"sqrt": true,
|
|
||||||
"tan": true,
|
|
||||||
"tanh": true,
|
|
||||||
"time": true,
|
|
||||||
// "timestamp" has been moved to rollup funcs. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415
|
|
||||||
"vector": true,
|
|
||||||
"year": true,
|
|
||||||
|
|
||||||
// New funcs from MetricsQL
|
|
||||||
"label_set": true,
|
|
||||||
"label_map": true,
|
|
||||||
"label_uppercase": true,
|
|
||||||
"label_lowercase": true,
|
|
||||||
"label_del": true,
|
|
||||||
"label_keep": true,
|
|
||||||
"label_copy": true,
|
"label_copy": true,
|
||||||
"label_move": true,
|
"label_del": true,
|
||||||
"label_transform": true,
|
"label_graphite_group": true,
|
||||||
"label_value": true,
|
"label_join": true,
|
||||||
|
"label_keep": true,
|
||||||
|
"label_lowercase": true,
|
||||||
|
"label_map": true,
|
||||||
"label_match": true,
|
"label_match": true,
|
||||||
"label_mismatch": true,
|
"label_mismatch": true,
|
||||||
"label_graphite_group": true,
|
"label_move": true,
|
||||||
|
"label_replace": true,
|
||||||
"union": true,
|
"label_set": true,
|
||||||
"": true, // empty func is a synonym to union
|
"label_transform": true,
|
||||||
"keep_last_value": true,
|
"label_uppercase": true,
|
||||||
"keep_next_value": true,
|
"label_value": true,
|
||||||
"interpolate": true,
|
"ln": true,
|
||||||
"start": true,
|
"log2": true,
|
||||||
"end": true,
|
"log10": true,
|
||||||
"step": true,
|
"minute": true,
|
||||||
"running_sum": true,
|
"month": true,
|
||||||
"running_max": true,
|
"pi": true,
|
||||||
"running_min": true,
|
"prometheus_buckets": true,
|
||||||
"running_avg": true,
|
"rad": true,
|
||||||
"range_sum": true,
|
"rand": true,
|
||||||
"range_max": true,
|
"rand_exponential": true,
|
||||||
"range_min": true,
|
"rand_normal": true,
|
||||||
"range_avg": true,
|
"range_avg": true,
|
||||||
"range_first": true,
|
"range_first": true,
|
||||||
"range_last": true,
|
"range_last": true,
|
||||||
"range_quantile": true,
|
"range_max": true,
|
||||||
"smooth_exponential": true,
|
"range_min": true,
|
||||||
"remove_resets": true,
|
"range_quantile": true,
|
||||||
"rand": true,
|
"range_sum": true,
|
||||||
"rand_normal": true,
|
"remove_resets": true,
|
||||||
"rand_exponential": true,
|
"round": true,
|
||||||
"prometheus_buckets": true,
|
"running_avg": true,
|
||||||
"buckets_limit": true,
|
"running_max": true,
|
||||||
"histogram_share": true,
|
"running_min": true,
|
||||||
"histogram_avg": true,
|
"running_sum": true,
|
||||||
"histogram_stdvar": true,
|
"scalar": true,
|
||||||
"histogram_stddev": true,
|
"sgn": true,
|
||||||
"sort_by_label": true,
|
"sin": true,
|
||||||
"sort_by_label_desc": true,
|
"sinh": true,
|
||||||
"timezone_offset": true,
|
"smooth_exponential": true,
|
||||||
"bitmap_and": true,
|
"sort": true,
|
||||||
"bitmap_or": true,
|
"sort_by_label": true,
|
||||||
"bitmap_xor": true,
|
"sort_by_label_desc": true,
|
||||||
"histogram_quantiles": true,
|
"sort_desc": true,
|
||||||
|
"sqrt": true,
|
||||||
|
"start": true,
|
||||||
|
"step": true,
|
||||||
|
"tan": true,
|
||||||
|
"tanh": true,
|
||||||
|
"time": true,
|
||||||
|
// "timestamp" has been moved to rollup funcs. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/415
|
||||||
|
"timezone_offset": true,
|
||||||
|
"union": true,
|
||||||
|
"vector": true,
|
||||||
|
"year": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsTransformFunc returns whether funcName is known transform function.
|
// IsTransformFunc returns whether funcName is known transform function.
|
||||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -21,7 +21,7 @@ github.com/VictoriaMetrics/fasthttp/stackless
|
||||||
# github.com/VictoriaMetrics/metrics v1.18.1
|
# github.com/VictoriaMetrics/metrics v1.18.1
|
||||||
## explicit
|
## explicit
|
||||||
github.com/VictoriaMetrics/metrics
|
github.com/VictoriaMetrics/metrics
|
||||||
# github.com/VictoriaMetrics/metricsql v0.30.0
|
# github.com/VictoriaMetrics/metricsql v0.30.1
|
||||||
## explicit
|
## explicit
|
||||||
github.com/VictoriaMetrics/metricsql
|
github.com/VictoriaMetrics/metricsql
|
||||||
github.com/VictoriaMetrics/metricsql/binaryop
|
github.com/VictoriaMetrics/metricsql/binaryop
|
||||||
|
|
Loading…
Reference in a new issue