Skip to content

Commit

Permalink
Merge pull request #19 from totvslabs/logsCollection
Browse files Browse the repository at this point in the history
feat: report clusterLogsCollection metrics
  • Loading branch information
caarlos0 authored Dec 20, 2018
2 parents cf644a5 + 88b918c commit 737b5fa
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions collector/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
nil,
nil,
),
}
}

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 737b5fa

Please sign in to comment.