Skip to content

Commit

Permalink
Merge pull request #94 from azr/patch-1
Browse files Browse the repository at this point in the history
exclude a metric if it contains a dash
  • Loading branch information
oliver006 authored Sep 1, 2017
2 parents 7851752 + 353b064 commit d4b0809
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion exporter/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ func includeMetric(s string) bool {
return ok
}

func sanitizeMetricName(n string) string {
n = strings.Replace(n, "-", "_", 0)
return n
}

func extractVal(s string) (val float64, err error) {
split := strings.Split(s, "=")
if len(split) != 2 {
Expand Down Expand Up @@ -388,7 +393,7 @@ func (e *Exporter) extractInfoMetrics(info, addr string, alias string, scrapes c
continue
}

metricName := split[0]
metricName := sanitizeMetricName(split[0])
if newName, ok := metricMap[metricName]; ok {
metricName = newName
}
Expand Down

0 comments on commit d4b0809

Please sign in to comment.