diff --git a/CHANGELOG.md b/CHANGELOG.md index 85ec173978335..791fd09fdcd18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features +- [#1782](https://github.com/influxdata/telegraf/pull/1782): Allow numeric and non-string values for tag_keys. - [#1694](https://github.com/influxdata/telegraf/pull/1694): Adding Gauge and Counter metric types. - [#1606](https://github.com/influxdata/telegraf/pull/1606): Remove carraige returns from exec plugin output on Windows - [#1674](https://github.com/influxdata/telegraf/issues/1674): elasticsearch input: configurable timeout. @@ -23,6 +24,7 @@ ### Bugfixes +- [#1746](https://github.com/influxdata/telegraf/issues/1746): Fix handling of non-string values for JSON keys listed in tag_keys. - [#1628](https://github.com/influxdata/telegraf/issues/1628): Fix mongodb input panic on version 2.2. - [#1733](https://github.com/influxdata/telegraf/issues/1733): Fix statsd scientific notation parsing - [#1716](https://github.com/influxdata/telegraf/issues/1716): Sensors plugin strconv.ParseFloat: parsing "": invalid syntax diff --git a/plugins/parsers/json/parser.go b/plugins/parsers/json/parser.go index e5172ac97b116..180f2452aff15 100644 --- a/plugins/parsers/json/parser.go +++ b/plugins/parsers/json/parser.go @@ -35,6 +35,10 @@ func (p *JSONParser) Parse(buf []byte) ([]telegraf.Metric, error) { switch v := jsonOut[tag].(type) { case string: tags[tag] = v + case bool: + tags[tag] = strconv.FormatBool(v) + case float64: + tags[tag] = strconv.FormatFloat(v, 'f', -1, 64) } delete(jsonOut, tag) }