Skip to content

Commit

Permalink
include a repointParserFunctions() function versus copyParserFunction()
Browse files Browse the repository at this point in the history
  • Loading branch information
praymann committed Jul 21, 2023
1 parent 38b23c2 commit 68bf68c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions promql/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,9 @@ func init() {
// copyParserFunction("delta", "orig_delta")
// copyParserFunction("increase", "orig_increase")
// copyParserFunction("rate", "orig_rate")
repointParserFunctions("delta", "xdelta")
repointParserFunctions("increase", "xincrease")
repointParserFunctions("rate", "xrate")
repointFunction("delta", "xdelta" /*, "orig_delta" */)
repointFunction("increase", "xincrease" /*, "orig_increase" */)
repointFunction("rate", "xrate" /*, "orig_rate" */)
Expand All @@ -1401,6 +1404,9 @@ func init() {
// copyParserFunction("delta", "orig_delta")
// copyParserFunction("increase", "orig_increase")
// copyParserFunction("rate", "orig_rate")
repointParserFunctions("delta", "ydelta")
repointParserFunctions("increase", "yincrease")
repointParserFunctions("rate", "yrate")
repointFunction("delta", "ydelta" /*, "orig_delta" */)
repointFunction("increase", "yincrease" /*, "orig_increase" */)
repointFunction("rate", "yrate" /*, "orig_rate" */)
Expand All @@ -1417,6 +1423,11 @@ func copyParserFunction(fromName, toName string) {
}
*/

func repointParserFunctions(name, newName string) {
parser.Functions[name] = parser.Functions[newName]
parser.Functions[name].Name = newName
}

func repointFunction(name, newName string /*, origName string */) {
// FunctionCalls[origName] = FunctionCalls[name]
FunctionCalls[name] = FunctionCalls[newName]
Expand Down

0 comments on commit 68bf68c

Please sign in to comment.