Insert . between msrmnt and field name in datadog output

fixes #600
This commit is contained in:
Cameron Sparr 2016-01-28 11:28:33 -07:00 committed by Ryan Merrick
parent 2af134ca08
commit 70f9fa80c5
2 changed files with 11 additions and 1 deletions

View File

@ -7,7 +7,9 @@
- [#603](https://github.com/influxdata/telegraf/pull/603): Aggregate statsd timing measurements into fields. Thanks @marcinbunsch! - [#603](https://github.com/influxdata/telegraf/pull/603): Aggregate statsd timing measurements into fields. Thanks @marcinbunsch!
### Bugfixes ### Bugfixes
- [#595](https://github.com/influxdata/telegraf/issues/595): graphite output should include tags to separate duplicate measurements.
- [#599](https://github.com/influxdata/telegraf/issues/599): datadog plugin tags not working. - [#599](https://github.com/influxdata/telegraf/issues/599): datadog plugin tags not working.
- [#600](https://github.com/influxdata/telegraf/issues/600): datadog measurement/field name parsing is wrong.
## v0.10.1 [2016-01-27] ## v0.10.1 [2016-01-27]

View File

@ -74,8 +74,16 @@ func (d *Datadog) Write(metrics []telegraf.Metric) error {
mname := strings.Replace(m.Name(), "_", ".", -1) mname := strings.Replace(m.Name(), "_", ".", -1)
if dogMs, err := buildMetrics(m); err == nil { if dogMs, err := buildMetrics(m); err == nil {
for fieldName, dogM := range dogMs { for fieldName, dogM := range dogMs {
// name of the datadog measurement
var dname string
if fieldName == "value" {
// adding .value seems redundant here
dname = mname
} else {
dname = mname + "." + strings.Replace(fieldName, "_", ".", -1)
}
metric := &Metric{ metric := &Metric{
Metric: mname + strings.Replace(fieldName, "_", ".", -1), Metric: dname,
Tags: buildTags(m.Tags()), Tags: buildTags(m.Tags()),
Host: m.Tags()["host"], Host: m.Tags()["host"],
} }