From be7de16dd535d9a67b85e7c7a9001541c46e6e67 Mon Sep 17 00:00:00 2001 From: Patrick Hemmer Date: Fri, 17 Mar 2017 13:14:03 -0400 Subject: [PATCH] return error on unsupported serializer data format (#2542) --- CHANGELOG.md | 1 + plugins/serializers/registry.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea1ccca4d..5ef7f580b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ be deprecated eventually. - [#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 - [#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] diff --git a/plugins/serializers/registry.go b/plugins/serializers/registry.go index 83be4900b..cb1e03b46 100644 --- a/plugins/serializers/registry.go +++ b/plugins/serializers/registry.go @@ -1,6 +1,8 @@ package serializers import ( + "fmt" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/plugins/serializers/graphite" @@ -49,6 +51,8 @@ func NewSerializer(config *Config) (Serializer, error) { serializer, err = NewGraphiteSerializer(config.Prefix, config.Template) case "json": serializer, err = NewJsonSerializer() + default: + err = fmt.Errorf("Invalid data format: %s", config.DataFormat) } return serializer, err }