Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pkg/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package parser
import (
"maps"

"github.com/prometheus/prometheus/promql"
promqlparser "github.com/prometheus/prometheus/promql/parser"
"github.com/thanos-io/promql-engine/execution/parse"
)
Expand All @@ -13,6 +14,17 @@ func buildFunctions() map[string]*promqlparser.Function {
fns := make(map[string]*promqlparser.Function, len(promqlparser.Functions))
maps.Copy(fns, promqlparser.Functions)
maps.Copy(fns, parse.XFunctions)

// The holt_winters function was renamed to double_exponential_smoothing and marked experimental in Prometheus v3.
// Register holt_winters as an alias in cortexparser to maintain backward compatibility.
if des, ok := fns["double_exponential_smoothing"]; ok {
holtWinters := *des
holtWinters.Experimental = false
holtWinters.Name = "holt_winters"
fns["holt_winters"] = &holtWinters
promql.FunctionCalls["holt_winters"] = promql.FunctionCalls["double_exponential_smoothing"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test?
Also I am trying to understand why our integration test didn't capture this issue before. https://github.com/cortexproject/cortex/blob/master/integration/backward_compatibility_test.go#L161

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think this should be behind a feature flag as well. Same as

func EnableExperimentalPromQLFunctions(enablePromQLExperimentalFunctions, enableHoltWinters bool) {
. Even though we hardcode to true today we may want to expose a flag so that we can disable the fallback in the future.

}

return fns
}

Expand Down
Loading