From a4011f674e0b8e2b394f4143c8008f85bb875edd Mon Sep 17 00:00:00 2001 From: Arve Knudsen Date: Wed, 6 Nov 2024 16:49:17 +0100 Subject: [PATCH] Remove holt_winters_alias Signed-off-by: Arve Knudsen --- promql/functions.go | 86 +++++++++---------- promql/parser/functions.go | 7 -- web/ui/mantine-ui/src/promql/functionMeta.ts | 3 - .../src/promql/functionSignatures.ts | 7 -- .../src/complete/promql.terms.ts | 7 -- .../codemirror-promql/src/types/function.ts | 9 -- web/ui/module/lezer-promql/src/highlight.js | 2 +- web/ui/module/lezer-promql/src/promql.grammar | 4 - 8 files changed, 43 insertions(+), 82 deletions(-) diff --git a/promql/functions.go b/promql/functions.go index fab30166d..e93a4cdc5 100644 --- a/promql/functions.go +++ b/promql/functions.go @@ -1668,50 +1668,48 @@ var FunctionCalls = map[string]FunctionCall{ "histogram_stddev": funcHistogramStdDev, "histogram_stdvar": funcHistogramStdVar, "double_exponential_smoothing": funcDoubleExponentialSmoothing, - // Keep an alias for Mimir users using holt_winters. - "holt_winters": funcDoubleExponentialSmoothing, - "hour": funcHour, - "idelta": funcIdelta, - "increase": funcIncrease, - "info": nil, - "irate": funcIrate, - "label_replace": nil, // evalLabelReplace not called via this map. - "label_join": nil, // evalLabelJoin not called via this map. - "ln": funcLn, - "log10": funcLog10, - "log2": funcLog2, - "last_over_time": funcLastOverTime, - "mad_over_time": funcMadOverTime, - "max_over_time": funcMaxOverTime, - "min_over_time": funcMinOverTime, - "minute": funcMinute, - "month": funcMonth, - "pi": funcPi, - "predict_linear": funcPredictLinear, - "present_over_time": funcPresentOverTime, - "quantile_over_time": funcQuantileOverTime, - "rad": funcRad, - "rate": funcRate, - "resets": funcResets, - "round": funcRound, - "scalar": funcScalar, - "sgn": funcSgn, - "sin": funcSin, - "sinh": funcSinh, - "sort": funcSort, - "sort_desc": funcSortDesc, - "sort_by_label": funcSortByLabel, - "sort_by_label_desc": funcSortByLabelDesc, - "sqrt": funcSqrt, - "stddev_over_time": funcStddevOverTime, - "stdvar_over_time": funcStdvarOverTime, - "sum_over_time": funcSumOverTime, - "tan": funcTan, - "tanh": funcTanh, - "time": funcTime, - "timestamp": funcTimestamp, - "vector": funcVector, - "year": funcYear, + "hour": funcHour, + "idelta": funcIdelta, + "increase": funcIncrease, + "info": nil, + "irate": funcIrate, + "label_replace": nil, // evalLabelReplace not called via this map. + "label_join": nil, // evalLabelJoin not called via this map. + "ln": funcLn, + "log10": funcLog10, + "log2": funcLog2, + "last_over_time": funcLastOverTime, + "mad_over_time": funcMadOverTime, + "max_over_time": funcMaxOverTime, + "min_over_time": funcMinOverTime, + "minute": funcMinute, + "month": funcMonth, + "pi": funcPi, + "predict_linear": funcPredictLinear, + "present_over_time": funcPresentOverTime, + "quantile_over_time": funcQuantileOverTime, + "rad": funcRad, + "rate": funcRate, + "resets": funcResets, + "round": funcRound, + "scalar": funcScalar, + "sgn": funcSgn, + "sin": funcSin, + "sinh": funcSinh, + "sort": funcSort, + "sort_desc": funcSortDesc, + "sort_by_label": funcSortByLabel, + "sort_by_label_desc": funcSortByLabelDesc, + "sqrt": funcSqrt, + "stddev_over_time": funcStddevOverTime, + "stdvar_over_time": funcStdvarOverTime, + "sum_over_time": funcSumOverTime, + "tan": funcTan, + "tanh": funcTanh, + "time": funcTime, + "timestamp": funcTimestamp, + "vector": funcVector, + "year": funcYear, } // AtModifierUnsafeFunctions are the functions whose result diff --git a/promql/parser/functions.go b/promql/parser/functions.go index 8acde2bfa..aa65aca27 100644 --- a/promql/parser/functions.go +++ b/promql/parser/functions.go @@ -208,13 +208,6 @@ var Functions = map[string]*Function{ ReturnType: ValueTypeVector, Experimental: true, }, - // Keep an alias for Mimir users using holt_winters. - "holt_winters": { - Name: "holt_winters", - ArgTypes: []ValueType{ValueTypeMatrix, ValueTypeScalar, ValueTypeScalar}, - ReturnType: ValueTypeVector, - Experimental: true, - }, "hour": { Name: "hour", ArgTypes: []ValueType{ValueTypeVector}, diff --git a/web/ui/mantine-ui/src/promql/functionMeta.ts b/web/ui/mantine-ui/src/promql/functionMeta.ts index 219705f0b..1dec46662 100644 --- a/web/ui/mantine-ui/src/promql/functionMeta.ts +++ b/web/ui/mantine-ui/src/promql/functionMeta.ts @@ -18,8 +18,6 @@ export const functionArgNames: Record = { // floor: [], histogram_quantile: ['target quantile', 'histogram'], double_exponential_smoothing: ['input series', 'smoothing factor', 'trend factor'], - // double_exponential_smoothing alias. - holt_winters: ['input series', 'smoothing factor', 'trend factor'], hour: ['timestamp (default = vector(time()))'], // idelta: [], // increase: [], @@ -71,7 +69,6 @@ export const functionDescriptions: Record = { floor: 'round down values of input series to nearest integer', histogram_quantile: 'calculate quantiles from histogram buckets', double_exponential_smoothing: 'calculate smoothed value of input series', - holt_winters: 'calculate smoothed value of input series', hour: 'return the hour of the day for provided timestamps', idelta: 'calculate the difference between the last two samples of a range vector (for counters)', increase: 'calculate the increase in value over a range of time (for counters)', diff --git a/web/ui/mantine-ui/src/promql/functionSignatures.ts b/web/ui/mantine-ui/src/promql/functionSignatures.ts index 3a9772fc2..472d54ac5 100644 --- a/web/ui/mantine-ui/src/promql/functionSignatures.ts +++ b/web/ui/mantine-ui/src/promql/functionSignatures.ts @@ -66,13 +66,6 @@ export const functionSignatures: Record = { variadic: 0, returnType: valueType.vector, }, - // double_exponential_smoothing alias. - holt_winters: { - name: 'holt_winters', - argTypes: [valueType.matrix, valueType.scalar, valueType.scalar], - variadic: 0, - returnType: valueType.vector, - }, hour: { name: 'hour', argTypes: [valueType.vector], variadic: 1, returnType: valueType.vector }, idelta: { name: 'idelta', argTypes: [valueType.matrix], variadic: 0, returnType: valueType.vector }, increase: { name: 'increase', argTypes: [valueType.matrix], variadic: 0, returnType: valueType.vector }, diff --git a/web/ui/module/codemirror-promql/src/complete/promql.terms.ts b/web/ui/module/codemirror-promql/src/complete/promql.terms.ts index 5ff9228b3..e2a1441fb 100644 --- a/web/ui/module/codemirror-promql/src/complete/promql.terms.ts +++ b/web/ui/module/codemirror-promql/src/complete/promql.terms.ts @@ -263,13 +263,6 @@ export const functionIdentifierTerms = [ info: 'Calculate smoothed value of input series', type: 'function', }, - // double_exponential_smoothing alias. - { - label: 'holt_winters', - detail: 'function', - info: 'Calculate smoothed value of input series', - type: 'function', - }, { label: 'hour', detail: 'function', diff --git a/web/ui/module/codemirror-promql/src/types/function.ts b/web/ui/module/codemirror-promql/src/types/function.ts index 42f4f5620..56d590412 100644 --- a/web/ui/module/codemirror-promql/src/types/function.ts +++ b/web/ui/module/codemirror-promql/src/types/function.ts @@ -47,8 +47,6 @@ import { HistogramStdVar, HistogramSum, DoubleExponentialSmoothing, - // double_exponential_smoothing alias. - HoltWinters, Hour, Idelta, Increase, @@ -321,13 +319,6 @@ const promqlFunctions: { [key: number]: PromQLFunction } = { variadic: 0, returnType: ValueType.vector, }, - // double_exponential_smoothing alias. - [HoltWinters]: { - name: 'holt_winters', - argTypes: [ValueType.matrix, ValueType.scalar, ValueType.scalar], - variadic: 0, - returnType: ValueType.vector, - }, [Hour]: { name: 'hour', argTypes: [ValueType.vector], diff --git a/web/ui/module/lezer-promql/src/highlight.js b/web/ui/module/lezer-promql/src/highlight.js index a87e37641..364c4e39a 100644 --- a/web/ui/module/lezer-promql/src/highlight.js +++ b/web/ui/module/lezer-promql/src/highlight.js @@ -20,7 +20,7 @@ export const promQLHighLight = styleTags({ NumberDurationLiteral: tags.number, NumberDurationLiteralInDurationContext: tags.number, Identifier: tags.variableName, - 'Abs Absent AbsentOverTime Acos Acosh Asin Asinh Atan Atanh AvgOverTime Ceil Changes Clamp ClampMax ClampMin Cos Cosh CountOverTime DaysInMonth DayOfMonth DayOfWeek DayOfYear Deg Delta Deriv Exp Floor HistogramAvg HistogramCount HistogramFraction HistogramQuantile HistogramSum DoubleExponentialSmoothing HoltWinters Hour Idelta Increase Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MaxOverTime MinOverTime Minute Month Pi PredictLinear PresentOverTime QuantileOverTime Rad Rate Resets Round Scalar Sgn Sin Sinh Sort SortDesc SortByLabel SortByLabelDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Tan Tanh Time Timestamp Vector Year': + 'Abs Absent AbsentOverTime Acos Acosh Asin Asinh Atan Atanh AvgOverTime Ceil Changes Clamp ClampMax ClampMin Cos Cosh CountOverTime DaysInMonth DayOfMonth DayOfWeek DayOfYear Deg Delta Deriv Exp Floor HistogramAvg HistogramCount HistogramFraction HistogramQuantile HistogramSum DoubleExponentialSmoothing Hour Idelta Increase Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MaxOverTime MinOverTime Minute Month Pi PredictLinear PresentOverTime QuantileOverTime Rad Rate Resets Round Scalar Sgn Sin Sinh Sort SortDesc SortByLabel SortByLabelDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Tan Tanh Time Timestamp Vector Year': tags.function(tags.variableName), 'Avg Bottomk Count Count_values Group LimitK LimitRatio Max Min Quantile Stddev Stdvar Sum Topk': tags.operatorKeyword, 'By Without Bool On Ignoring GroupLeft GroupRight Offset Start End': tags.modifier, diff --git a/web/ui/module/lezer-promql/src/promql.grammar b/web/ui/module/lezer-promql/src/promql.grammar index a27d5a0b2..f8850fc2b 100644 --- a/web/ui/module/lezer-promql/src/promql.grammar +++ b/web/ui/module/lezer-promql/src/promql.grammar @@ -142,8 +142,6 @@ FunctionIdentifier { HistogramSum | HistogramAvg | DoubleExponentialSmoothing | - // DoubleExponentialSmoothing alias. - HoltWinters | Hour | Idelta | Increase | @@ -392,8 +390,6 @@ NumberDurationLiteralInDurationContext { HistogramStdVar { condFn<"histogram_stdvar"> } HistogramSum { condFn<"histogram_sum"> } DoubleExponentialSmoothing { condFn<"double_exponential_smoothing"> } - // DoubleExponentialSmoothing alias. - HoltWinters { condFn<"holt_winters"> } Hour { condFn<"hour"> } Idelta { condFn<"idelta"> } Increase { condFn<"increase"> }