Skip to content

Commit

Permalink
Add option to disable statsd name conversion
Browse files Browse the repository at this point in the history
closes #467
  • Loading branch information
sparrc committed Jan 15, 2016
1 parent f60c090 commit 9155d28
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plugins/inputs/statsd/statsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Statsd struct {
DeleteCounters bool
DeleteSets bool
DeleteTimings bool
ConvertNames bool

sync.Mutex

Expand Down Expand Up @@ -63,6 +64,8 @@ func NewStatsd() *Statsd {
s.sets = make(map[string]cachedset)
s.timings = make(map[string]cachedtimings)

s.ConvertNames = true

return &s
}

Expand Down Expand Up @@ -121,6 +124,9 @@ const sampleConfig = `
# Percentiles to calculate for timing & histogram stats
percentiles = [90]
# convert measurement names, "." to "_" and "-" to "__"
convert_names = true
# templates = [
# "cpu.* measurement*"
# ]
Expand Down Expand Up @@ -389,8 +395,10 @@ func (s *Statsd) parseName(bucket string) (string, map[string]string) {
if err == nil {
name, tags, _, _ = p.ApplyTemplate(name)
}
name = strings.Replace(name, ".", "_", -1)
name = strings.Replace(name, "-", "__", -1)
if s.ConvertNames {
name = strings.Replace(name, ".", "_", -1)
name = strings.Replace(name, "-", "__", -1)
}

return name, tags
}
Expand Down Expand Up @@ -491,6 +499,6 @@ func (s *Statsd) Stop() {

func init() {
inputs.Add("statsd", func() inputs.Input {
return &Statsd{}
return &Statsd{ConvertNames: true}
})
}

0 comments on commit 9155d28

Please sign in to comment.