mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Fix Classic Conditions $values variable (#64243)
This commit fixes a bug in the $values variable in notification templates when using Classic Conditions. Since Classic Conditions are not multi-dimensional, the values of each series that exceeded the condition should be available as a RefID and offset. For example, B0, B1, etc. However, this bug meant that instead just a single condition would be printed as B, not B0.
This commit is contained in:
@@ -52,11 +52,11 @@ func (rs *ruleStates) getOrCreate(ctx context.Context, log log.Logger, alertRule
|
||||
ruleLabels, annotations := rs.expandRuleLabelsAndAnnotations(ctx, log, alertRule, result, extraLabels, externalURL)
|
||||
|
||||
values := make(map[string]float64)
|
||||
for _, v := range result.Values {
|
||||
for refID, v := range result.Values {
|
||||
if v.Value != nil {
|
||||
values[v.Var] = *v.Value
|
||||
values[refID] = *v.Value
|
||||
} else {
|
||||
values[v.Var] = math.NaN()
|
||||
values[refID] = math.NaN()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user