From 151302efd487ea40db1155fb8a23516e5395030c Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 20 Dec 2018 16:18:51 -0200 Subject: [PATCH 1/2] feat: report clusterLogsCollection metrics --- collector/task.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/collector/task.go b/collector/task.go index b0ff73f..6ccbb85 100644 --- a/collector/task.go +++ b/collector/task.go @@ -13,11 +13,12 @@ type taskCollector struct { mutex sync.Mutex client client.Client - up *prometheus.Desc - scrapeDuration *prometheus.Desc - rebalance *prometheus.Desc - rebalancePerNode *prometheus.Desc - compacting *prometheus.Desc + up *prometheus.Desc + scrapeDuration *prometheus.Desc + rebalance *prometheus.Desc + rebalancePerNode *prometheus.Desc + compacting *prometheus.Desc + clusterLogsCollection *prometheus.Desc } // NewTasksCollector tasks collector @@ -56,6 +57,12 @@ func NewTasksCollector(client client.Client) prometheus.Collector { []string{"bucket"}, nil, ), + clusterLogsCollection: prometheus.NewDesc( + prometheus.BuildFQName(namespace, subsystem, "cluster_logs_collection_progress"), + "Progress of a cluster logs collection task", + []string{"bucket"}, + nil, + ), } } @@ -66,6 +73,7 @@ func (c *taskCollector) Describe(ch chan<- *prometheus.Desc) { ch <- c.rebalance ch <- c.rebalancePerNode ch <- c.compacting + ch <- c.clusterLogsCollection } // Collect all metrics @@ -106,8 +114,10 @@ func (c *taskCollector) Collect(ch chan<- prometheus.Metric) { ch <- prometheus.MustNewConstMetric(c.compacting, prometheus.GaugeValue, task.Progress, task.Bucket) } compactsReported[task.Bucket] = true + case "clusterLogsCollection": + ch <- prometheus.MustNewConstMetric(c.clusterLogsCollection, prometheus.GaugeValue, task.Progress) default: - log.With("type", task.Type).Error("not implemented") + log.With("type", task.Type).Warn("not implemented") } } // always report the compacting task, even if it is not happening From 88b918ce77019d7c3fa09b2ee42712bbe5948564 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 20 Dec 2018 16:21:06 -0200 Subject: [PATCH 2/2] fix: label cardinality --- collector/task.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/task.go b/collector/task.go index 6ccbb85..1143202 100644 --- a/collector/task.go +++ b/collector/task.go @@ -60,7 +60,7 @@ func NewTasksCollector(client client.Client) prometheus.Collector { clusterLogsCollection: prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, "cluster_logs_collection_progress"), "Progress of a cluster logs collection task", - []string{"bucket"}, + nil, nil, ), }