mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Exclude expression refIDs from NoData state (#72219)
This commit is contained in:
parent
78fc3bcdf4
commit
5ba164d92b
@ -324,8 +324,6 @@ func queryDataResponseToExecutionResults(c models.Condition, execResp *backend.Q
|
||||
for _, next := range c.Data {
|
||||
datasourceUIDsForRefIDs[next.RefID] = next.DatasourceUID
|
||||
}
|
||||
// datasourceExprUID is a special DatasourceUID for expressions
|
||||
datasourceExprUID := strconv.FormatInt(expr.DatasourceID, 10)
|
||||
|
||||
result := ExecutionResults{Results: make(map[string]data.Frames)}
|
||||
for refID, res := range execResp.Responses {
|
||||
@ -347,7 +345,7 @@ func queryDataResponseToExecutionResults(c models.Condition, execResp *backend.Q
|
||||
hasNoFrames := len(res.Frames) == 0
|
||||
hasNoFields := len(res.Frames) == 1 && len(res.Frames[0].Fields) == 0
|
||||
if hasNoFrames || hasNoFields {
|
||||
if s, ok := datasourceUIDsForRefIDs[refID]; ok && s != datasourceExprUID {
|
||||
if s, ok := datasourceUIDsForRefIDs[refID]; ok && expr.NodeTypeFromDatasourceUID(s) == expr.TypeDatasourceNode { // TODO perhaps extract datasource UID from ML expression too.
|
||||
result.NoData[refID] = s
|
||||
}
|
||||
}
|
||||
|
@ -562,11 +562,23 @@ func TestEvaluate(t *testing.T) {
|
||||
Data: []models.AlertQuery{{
|
||||
RefID: "A",
|
||||
DatasourceUID: "test",
|
||||
}, {
|
||||
RefID: "B",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
}, {
|
||||
RefID: "C",
|
||||
DatasourceUID: expr.OldDatasourceUID,
|
||||
}, {
|
||||
RefID: "D",
|
||||
DatasourceUID: expr.MLDatasourceUID,
|
||||
}},
|
||||
},
|
||||
resp: backend.QueryDataResponse{
|
||||
Responses: backend.Responses{
|
||||
"A": {Frames: nil},
|
||||
"B": {Frames: []*data.Frame{{Fields: nil}}},
|
||||
"C": {Frames: nil},
|
||||
"D": {Frames: []*data.Frame{{Fields: nil}}},
|
||||
},
|
||||
},
|
||||
expected: Results{{
|
||||
|
Loading…
Reference in New Issue
Block a user