Initialize histograms to zero

This commit is contained in:
Bart Vercoulen 2018-02-07 14:24:08 +01:00
parent d0b229822e
commit 6569ec9d20
2 changed files with 11 additions and 0 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
postfix_exporter
.idea/

View File

@ -111,6 +111,11 @@ func CollectTextualShowqFromReader(file io.Reader, ch chan<- prometheus.Metric)
},
[]string{"queue"})
for _, q := range []string{"active", "hold", "other"} {
sizeHistogram.WithLabelValues(q)
ageHistogram.WithLabelValues(q)
}
now := time.Now()
location, _ := time.LoadLocation("Local")
for scanner.Scan() {
@ -192,6 +197,11 @@ func CollectBinaryShowqFromReader(file io.Reader, ch chan<- prometheus.Metric) e
},
[]string{"queue"})
for _, q := range []string{"active", "deferred", "hold", "incoming", "maildrop"} {
sizeHistogram.WithLabelValues(q)
ageHistogram.WithLabelValues(q)
}
now := float64(time.Now().UnixNano()) / 1e9
queue := "unknown"
for scanner.Scan() {