From d30da66d77edb7bc9fa049b771353debe14a23d4 Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> Date: Mon, 9 Nov 2020 18:21:50 +0530 Subject: [PATCH] Fix timestamp() method for vector selector inside paren (#8164) Signed-off-by: Ganesh Vernekar --- promql/engine.go | 1 + promql/testdata/functions.test | 3 +++ 2 files changed, 4 insertions(+) diff --git a/promql/engine.go b/promql/engine.go index c21319b416..81bd70d5fb 100644 --- a/promql/engine.go +++ b/promql/engine.go @@ -1027,6 +1027,7 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, storage.Warnings) { // Matrix evaluation always returns the evaluation time, // so this function needs special handling when given // a vector selector. + unwrapParenExpr(&e.Args[0]) vs, ok := e.Args[0].(*parser.VectorSelector) if ok { return ev.rangeEval(func(v []parser.Value, enh *EvalNodeHelper) (Vector, storage.Warnings) { diff --git a/promql/testdata/functions.test b/promql/testdata/functions.test index 4703d53092..0279f880d1 100644 --- a/promql/testdata/functions.test +++ b/promql/testdata/functions.test @@ -300,6 +300,9 @@ eval instant at 0s timestamp(metric) eval instant at 5s timestamp(metric) {} 0 +eval instant at 5s timestamp(((metric))) + {} 0 + eval instant at 10s timestamp(metric) {} 10