Alerting: Fix DatasourceUID and RefID missing for DatasourceNoData alerts (#66733)

This commit fixes a bug where DatasourceUID and RefID annotations are
missing for DatasourceNoData alerts in Grafana 9.5. This bug affects
datasource plugins that have moved to using the data plane contract.
This commit is contained in:
George Robinson
2023-04-20 14:38:20 +01:00
committed by GitHub
parent 78d7b6c0c9
commit 35342a3c76
2 changed files with 38 additions and 5 deletions
+20
View File
@@ -575,6 +575,26 @@ func TestEvaluate(t *testing.T) {
"ref_id": "A",
},
}},
}, {
name: "is no data for one frame with no fields",
cond: models.Condition{
Data: []models.AlertQuery{{
RefID: "A",
DatasourceUID: "test",
}},
},
resp: backend.QueryDataResponse{
Responses: backend.Responses{
"A": {Frames: []*data.Frame{{Fields: nil}}},
},
},
expected: Results{{
State: NoData,
Instance: data.Labels{
"datasource_uid": "test",
"ref_id": "A",
},
}},
}}
for _, tc := range cases {