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
parent 1f1384afc6
commit d835c19fce
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!
### 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.
- [#600](https://github.com/influxdata/telegraf/issues/600): datadog measurement/field name parsing is wrong.
## 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)
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
} else {
dname = mname + "." + strings.Replace(fieldName, "_", ".", -1)
}
metric := &Metric{
Metric: mname + strings.Replace(fieldName, "_", ".", -1),
Metric: dname,
Tags: buildTags(m.Tags()),
Host: m.Tags()["host"],
}