rcd: fix incorrect prometheus metrics - fixes #4341

This was caused by using the stats group from the context passed in by the rcd
rather than the global stats group.

Signed-off-by: Gary Kim <gary@garykim.dev>
This commit is contained in:
Gary Kim 2020-06-14 17:09:24 +08:00 committed by GitHub
parent f4d7e41f24
commit 763944f673
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,7 +76,7 @@ func (c *RcloneCollector) Describe(ch chan<- *prometheus.Desc) {
// Collect is part of the Collector interface: https://godoc.org/github.com/prometheus/client_golang/prometheus#Collector
func (c *RcloneCollector) Collect(ch chan<- prometheus.Metric) {
s := GlobalStats()
s := groups.sum()
s.mu.RLock()
ch <- prometheus.MustNewConstMetric(c.bytesTransferred, prometheus.CounterValue, float64(s.bytes))