Skip to content

Commit

Permalink
Don't replace _ with . in datadog names
Browse files Browse the repository at this point in the history
closes #1024
  • Loading branch information
sparrc committed Apr 20, 2016
1 parent 2f7da03 commit 4bcf157
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ for more details.
only. Previously there was an undocumented behavior where filters would match
based on _prefix_ in addition to globs. This means that a filter like
`fielddrop = ["time_"]` will need to be changed to `fielddrop = ["time_*"]`
- **datadog**: measurement and field names will no longer have `_` replaced by `.`
- The following plugins have changed their tags to _not_ overwrite the host tag:
- cassandra: `host -> cassandra_host`
- disque: `host -> disque_host`
Expand All @@ -42,6 +43,7 @@ based on _prefix_ in addition to globs. This means that a filter like
- [#921](https://github.com/influxdata/telegraf/pull/921): mqtt_consumer stops gathering metrics. Thanks @chaton78!
- [#1013](https://github.com/influxdata/telegraf/pull/1013): Close dead riemann output connections. Thanks @echupriyanov!
- [#1012](https://github.com/influxdata/telegraf/pull/1012): Set default tags in test accumulator.
- [#1024](https://github.com/influxdata/telegraf/issues/1024): Don't replace `.` with `_` in datadog output.
- [#1058](https://github.com/influxdata/telegraf/issues/1058): Fix possible leaky TCP connections in influxdb output.
- [#1044](https://github.com/influxdata/telegraf/pull/1044): Fix SNMP OID possible collisions. Thanks @relip

Expand Down
10 changes: 5 additions & 5 deletions plugins/outputs/datadog/datadog.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"net/http"
"net/url"
"sort"
"strings"

"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
Expand Down Expand Up @@ -71,21 +70,22 @@ func (d *Datadog) Write(metrics []telegraf.Metric) error {
metricCounter := 0

for _, m := range metrics {
mname := strings.Replace(m.Name(), "_", ".", -1)
if dogMs, err := buildMetrics(m); err == nil {
for fieldName, dogM := range dogMs {
// name of the datadog measurement
var dname string
if fieldName == "value" {
// adding .value seems redundant here
dname = mname
dname = m.Name()
} else {
dname = mname + "." + strings.Replace(fieldName, "_", ".", -1)
dname = m.Name() + "." + fieldName
}
var host string
host, _ = m.Tags()["host"]
metric := &Metric{
Metric: dname,
Tags: buildTags(m.Tags()),
Host: m.Tags()["host"],
Host: host,
}
metric.Points[0] = dogM
tempSeries = append(tempSeries, metric)
Expand Down

0 comments on commit 4bcf157

Please sign in to comment.