return error on unsupported serializer data format (#2542)

This commit is contained in:
Patrick Hemmer 2017-03-17 13:14:03 -04:00 committed by Daniel Nelson
parent 426182b81a
commit 8514acdc3c
2 changed files with 5 additions and 0 deletions

View File

@ -81,6 +81,7 @@ be deprecated eventually.
- [#2500](https://github.com/influxdata/telegraf/pull/2500): Remove warning if parse empty content - [#2500](https://github.com/influxdata/telegraf/pull/2500): Remove warning if parse empty content
- [#2520](https://github.com/influxdata/telegraf/pull/2520): Update default value for Cloudwatch rate limit - [#2520](https://github.com/influxdata/telegraf/pull/2520): Update default value for Cloudwatch rate limit
- [#2513](https://github.com/influxdata/telegraf/issues/2513): create /etc/telegraf/telegraf.d directory in tarball. - [#2513](https://github.com/influxdata/telegraf/issues/2513): create /etc/telegraf/telegraf.d directory in tarball.
- [#2541](https://github.com/influxdata/telegraf/issues/2541): Return error on unsupported serializer data format.
## v1.2.1 [2017-02-01] ## v1.2.1 [2017-02-01]

View File

@ -1,6 +1,8 @@
package serializers package serializers
import ( import (
"fmt"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/serializers/graphite" "github.com/influxdata/telegraf/plugins/serializers/graphite"
@ -49,6 +51,8 @@ func NewSerializer(config *Config) (Serializer, error) {
serializer, err = NewGraphiteSerializer(config.Prefix, config.Template) serializer, err = NewGraphiteSerializer(config.Prefix, config.Template)
case "json": case "json":
serializer, err = NewJsonSerializer() serializer, err = NewJsonSerializer()
default:
err = fmt.Errorf("Invalid data format: %s", config.DataFormat)
} }
return serializer, err return serializer, err
} }