mirror of https://github.com/tidwall/tile38.git
Refactor for better coverage
This commit is contained in:
parent
891fd10ef6
commit
1001de7311
|
@ -92,9 +92,14 @@ func (s *Server) Collect(ch chan<- prometheus.Metric) {
|
||||||
s.extStats(m)
|
s.extStats(m)
|
||||||
|
|
||||||
for metric, descr := range metricDescriptions {
|
for metric, descr := range metricDescriptions {
|
||||||
if val, ok := m[metric].(int); ok {
|
val, ok := m[metric].(float64)
|
||||||
ch <- prometheus.MustNewConstMetric(descr, prometheus.GaugeValue, float64(val))
|
if !ok {
|
||||||
} else if val, ok := m[metric].(float64); ok {
|
val2, ok2 := m[metric].(int)
|
||||||
|
if ok2 {
|
||||||
|
val, ok = float64(val2), true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ok {
|
||||||
ch <- prometheus.MustNewConstMetric(descr, prometheus.GaugeValue, val)
|
ch <- prometheus.MustNewConstMetric(descr, prometheus.GaugeValue, val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue