Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
iimos committed Sep 11, 2020
1 parent ae04ce6 commit c8bb6fa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions exporter.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Code is based on https://github.com/deathowl/go-metrics-prometheus package.
package saramaprom

// This code is based on a code of https://github.com/deathowl/go-metrics-prometheus library.

import (
"fmt"
"strings"
Expand Down Expand Up @@ -46,7 +47,7 @@ func (c *exporter) gaugeFromNameAndValue(name string, val float64) error {
return nil
}

if _, exists := c.gauges[shortName]; !exists {
if _, exists := c.gauges[name]; !exists {
labelNames := make([]string, 0, len(labels))
for labelName := range labels {
labelNames = append(labelNames, labelName)
Expand All @@ -71,10 +72,10 @@ func (c *exporter) gaugeFromNameAndValue(name string, val float64) error {
return err
}
}
c.gauges[shortName] = g.With(labels)
c.gauges[name] = g.With(labels)
}

c.gauges[shortName].Set(val)
c.gauges[name].Set(val)
return nil
}

Expand Down

0 comments on commit c8bb6fa

Please sign in to comment.