From 0b66abba1845b5d7b6f847944561580ce42f542b Mon Sep 17 00:00:00 2001 From: Galen Kistler <109082771+gtk-grafana@users.noreply.github.com> Date: Wed, 19 Oct 2022 08:15:32 -0500 Subject: [PATCH] add case for empty influxdb 1 versions, so the health check doesn't fail (#56426) --- pkg/tsdb/influxdb/healthcheck.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/tsdb/influxdb/healthcheck.go b/pkg/tsdb/influxdb/healthcheck.go index 5a12e2ad350..8c0de631800 100644 --- a/pkg/tsdb/influxdb/healthcheck.go +++ b/pkg/tsdb/influxdb/healthcheck.go @@ -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) }