Alerting: Fix evaluation of rules with no-op math expressions
When you use a math expression with out any operators, the dataFrame pointer is identical between the expression result and the input query/expression.
This was resulting in the values returned from an evaluation overshadowing each other, depending on the order of the processing of the result map.
For example:
```
A: some_metric
B: reduce of A
C: math expression -> "${B}"
D: Threshold evaluation of C -> "C > 0"
```
With a value of 1 for `some_metric`, might result in a evaluation result of one of the following (somewhat at random):
1. { B: 1, D: 1 }
2. { C: 1, D: 1}
While you would expect to see:
{ B: 1, C: 1, D: 1 }
This commit is contained in:
committed by
Moustafa Baiou
parent
d78c646f93
commit
bc4be187af
@@ -501,7 +501,7 @@ func queryDataResponseToExecutionResults(c models.Condition, execResp *backend.Q
|
||||
if frame.Fields[0].Len() == 1 {
|
||||
v = frame.At(0, 0).(*float64) // type checked above
|
||||
}
|
||||
captureFn(frame.RefID, frame.Fields[0].Labels, v)
|
||||
captureFn(refID, frame.Fields[0].Labels, v)
|
||||
}
|
||||
|
||||
if refID == c.Condition {
|
||||
|
||||
Reference in New Issue
Block a user