Browse Source

Drop metric name for "atan2" binary operator

The operator changes the meaning of the metric, so the metric name should
be dropped. Technically this would be a breaking change, but it's also very
obviously a bug and not likely that anyone depends on it.

Signed-off-by: Julius Volz <julius.volz@gmail.com>
pull/12595/head
Julius Volz 1 year ago
parent
commit
531567d46e
  1. 2
      promql/engine.go
  2. 4
      promql/testdata/operators.test

2
promql/engine.go

@ -2874,7 +2874,7 @@ func btos(b bool) float64 {
// result of the op operation. // result of the op operation.
func shouldDropMetricName(op parser.ItemType) bool { func shouldDropMetricName(op parser.ItemType) bool {
switch op { switch op {
case parser.ADD, parser.SUB, parser.DIV, parser.MUL, parser.POW, parser.MOD: case parser.ADD, parser.SUB, parser.DIV, parser.MUL, parser.POW, parser.MOD, parser.ATAN2:
return true return true
default: default:
return false return false

4
promql/testdata/operators.test vendored

@ -477,10 +477,10 @@ load 5m
trigNaN{} NaN trigNaN{} NaN
eval instant at 5m trigy atan2 trigx eval instant at 5m trigy atan2 trigx
trigy{} 0.4636476090008061 {} 0.4636476090008061
eval instant at 5m trigy atan2 trigNaN eval instant at 5m trigy atan2 trigNaN
trigy{} NaN {} NaN
eval instant at 5m 10 atan2 20 eval instant at 5m 10 atan2 20
0.4636476090008061 0.4636476090008061

Loading…
Cancel
Save