Skip to content

Commit 5c42997

Browse files
committed
Add missing addBool to collectorlist
Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
1 parent e564cbf commit 5c42997

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

collector_structs.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ func (m *MetricCollectorList) AddIfGreaterZero(labels prometheus.Labels, value f
6262
}
6363
}
6464

65+
func (m *MetricCollectorList) AddBool(labels prometheus.Labels, state bool) {
66+
value := float64(0)
67+
if state {
68+
value = 1
69+
}
70+
71+
m.list = append(m.list, MetricCollectorRow{labels: labels, value: value})
72+
}
73+
74+
6575
func (m *MetricCollectorList) GaugeSet(gauge *prometheus.GaugeVec) {
6676
for _, metric := range m.list {
6777
gauge.With(metric.labels).Set(metric.value)

0 commit comments

Comments
 (0)