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:
Moustafa Baiou
2025-02-27 17:04:18 -05:00
committed by Moustafa Baiou
parent d78c646f93
commit bc4be187af
2 changed files with 297 additions and 218 deletions
+1 -1
View File
@@ -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 {