From a53d4ed197abb7f0f304fa17633d0fecbcc12343 Mon Sep 17 00:00:00 2001 From: Krasi Georgiev Date: Sun, 11 Feb 2018 18:15:55 +0200 Subject: [PATCH] drop metric name for bool modifier (#3821) fixes #3820 --- promql/engine.go | 2 +- promql/testdata/operators.test | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/promql/engine.go b/promql/engine.go index a4503f45e..f0dc8ed40 100644 --- a/promql/engine.go +++ b/promql/engine.go @@ -1151,7 +1151,7 @@ func (ev *evaluator) VectorscalarBinop(op itemType, lhs Vector, rhs Scalar, swap } if keep { lhsSample.V = value - if shouldDropMetricName(op) { + if shouldDropMetricName(op) || returnBool { lhsSample.Metric = dropMetricName(lhsSample.Metric) } vec = append(vec, lhsSample) diff --git a/promql/testdata/operators.test b/promql/testdata/operators.test index 2807991f3..1adb598c1 100644 --- a/promql/testdata/operators.test +++ b/promql/testdata/operators.test @@ -236,6 +236,9 @@ eval instant at 50m 0 == bool 1 eval instant at 50m 1 == bool 1 1 +eval instant at 50m http_requests{job="api-server", instance="0", group="production"} == bool 100 + {job="api-server", instance="0", group="production"} 1 + # group_left/group_right. clear