Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
change value in lineResult struct to float
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Tupitsyn authored and Dmitry Tupitsyn committed Oct 6, 2020
1 parent f3c5b12 commit 6f6145f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (e *Exporter) collect(ch chan<- prometheus.Metric) error {
Name: metricName(m.key),
Help: "Number of " + m.key + " currently processed",
}, []string{}).WithLabelValues()
newMetric.Set(float64(m.value))
newMetric.Set(m.value)
newMetric.Collect(ch)
}

Expand All @@ -123,7 +123,7 @@ func (e *Exporter) collect(ch chan<- prometheus.Metric) error {
Name: metricName(am.key),
Help: "Number of " + am.key + " async processed",
}, []string{}).WithLabelValues()
newMetric.Set(float64(am.value))
newMetric.Set(am.value)
newMetric.Collect(ch)
}

Expand All @@ -137,7 +137,7 @@ func (e *Exporter) collect(ch chan<- prometheus.Metric) error {
prometheus.NewDesc(
namespace+"_"+metricName(ev.key)+"_total",
"Number of "+ev.key+" total processed", []string{}, nil),
prometheus.CounterValue, float64(ev.value))
prometheus.CounterValue, ev.value)
ch <- newMetric
}

Expand Down Expand Up @@ -203,7 +203,7 @@ func (e *Exporter) handleResponse(uri string) ([]byte, error) {

type lineResult struct {
key string
value int
value float64
}

func (e *Exporter) parseKeyValueResponse(uri string) ([]lineResult, error) {
Expand All @@ -225,7 +225,7 @@ func (e *Exporter) parseKeyValueResponse(uri string) ([]lineResult, error) {
return nil, fmt.Errorf("parseKeyValueResponse: unexpected %d line: %s", i, line)
}
k := strings.TrimSpace(parts[0])
v, err := strconv.Atoi(strings.TrimSpace(parts[1]))
v, err := strconv.ParseFloat(strings.TrimSpace(parts[1]), 64)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 6f6145f

Please sign in to comment.