add case for empty influxdb 1 versions, so the health check doesn't fail (#56426)

This commit is contained in:
Galen Kistler
2022-10-19 08:15:32 -05:00
committed by GitHub
parent 05709ce411
commit 0b66abba18

View File

@@ -100,6 +100,11 @@ func CheckInfluxQLHealth(ctx context.Context, dsInfo *models.DatasourceInfo, s *
if res.Error != nil {
return getHealthCheckMessage(s, "error reading influxDB", res.Error)
}
if len(res.Frames) == 0 {
return getHealthCheckMessage(s, "0 measurements found", nil)
}
if len(res.Frames) > 0 && len(res.Frames[0].Fields) > 0 {
return getHealthCheckMessage(s, fmt.Sprintf("%d measurements found", res.Frames[0].Fields[0].Len()), nil)
}