Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Commit

Permalink
Swapped the zpool getStatus() to be run after the mutex lock and not …
Browse files Browse the repository at this point in the history
…before
  • Loading branch information
eripa committed Aug 22, 2015
1 parent 00b2eff commit 6969908
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion prometheus-zfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
// Collect fetches the stats from configured ZFS pool and delivers them
// as Prometheus metrics. It implements prometheus.Collector.
func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
e.zpool.getStatus()

e.mutex.Lock() // To protect metrics from concurrent collects.
defer e.mutex.Unlock()

e.zpool.getStatus()
e.poolUsage.Set(float64(e.zpool.capacity))
e.providersOnline.Set(float64(e.zpool.online))
e.providersFaulted.Set(float64(e.zpool.faulted))
Expand Down

0 comments on commit 6969908

Please sign in to comment.