From 4f20bba48d769952cd872287208ffe71805438a5 Mon Sep 17 00:00:00 2001 From: bruc vv Date: Thu, 17 Jun 2021 14:44:21 +0800 Subject: [PATCH 1/2] Fix snapshot_stats metrics which happens on HA hdfs type snapshot repository fix issue 415 err logs: "failed to fetch and decode snapshot stats" err:"json: cannot unmarshal object into Go struct field .settings of type string" " repository-hdfs is an elasticsearch plugin: https://www.elastic.co/guide/en/elasticsearch/plugins/current/repository-hdfs-config.html#repository-hdfs-config Signed-off-by: bruc vv --- collector/snapshots_reponse.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collector/snapshots_reponse.go b/collector/snapshots_reponse.go index 83e7b436..25937e6b 100644 --- a/collector/snapshots_reponse.go +++ b/collector/snapshots_reponse.go @@ -43,6 +43,6 @@ type SnapshotStatDataResponse struct { // SnapshotRepositoriesResponse is a representation snapshots repositories type SnapshotRepositoriesResponse map[string]struct { - Type string `json:"type"` - Settings map[string]string `json:"settings"` + Type string `json:"type"` + Settings map[string]interface{} `json:"settings"` } From 3bad103ed3c29ecea0bd5149478c0abee89bce1d Mon Sep 17 00:00:00 2001 From: bruc vv Date: Fri, 18 Jun 2021 14:54:05 +0800 Subject: [PATCH 2/2] Fix issue #415 remove unused field `Settings` of the struct `SnapshotRepositoriesResponse`. Signed-off-by: bruc vv --- collector/snapshots_reponse.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/collector/snapshots_reponse.go b/collector/snapshots_reponse.go index 25937e6b..09bc57f8 100644 --- a/collector/snapshots_reponse.go +++ b/collector/snapshots_reponse.go @@ -43,6 +43,5 @@ type SnapshotStatDataResponse struct { // SnapshotRepositoriesResponse is a representation snapshots repositories type SnapshotRepositoriesResponse map[string]struct { - Type string `json:"type"` - Settings map[string]interface{} `json:"settings"` + Type string `json:"type"` }