From c737a19d9f6ab6094a4e3128ab170123b30f9c9e Mon Sep 17 00:00:00 2001 From: Eugene Chupriyanov Date: Tue, 19 Apr 2016 01:08:18 +0300 Subject: [PATCH] Just close Riemann client on send metrics failure Signed-off-by: Eugene Chupriyanov closes #1013 --- CHANGELOG.md | 1 + plugins/outputs/riemann/riemann.go | 11 ++--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06dd76969..30257749b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ based on _prefix_ in addition to globs. This means that a filter like ### Bugfixes - [#921](https://github.com/influxdata/telegraf/pull/921): mqtt_consumer stops gathering metrics. Thanks @chaton78! +- [#1013](https://github.com/influxdata/telegraf/pull/1013): Close dead riemann output connections. Thanks @echupriyanov! ## v0.12.1 [2016-04-14] diff --git a/plugins/outputs/riemann/riemann.go b/plugins/outputs/riemann/riemann.go index 88c4b20de..bc49a7191 100644 --- a/plugins/outputs/riemann/riemann.go +++ b/plugins/outputs/riemann/riemann.go @@ -80,15 +80,8 @@ func (r *Riemann) Write(metrics []telegraf.Metric) error { var senderr = r.client.SendMulti(events) if senderr != nil { r.Close() // always retuns nil - connerr := r.Connect() - if connerr != nil { - return fmt.Errorf("FAILED to (re)connect to Riemann. Error: %s\n", connerr) - } - senderr = r.client.SendMulti(events) - if senderr != nil { - return fmt.Errorf("FAILED to send riemann message (will try to reconnect). Error: %s\n", - senderr) - } + return fmt.Errorf("FAILED to send riemann message (will try to reconnect). Error: %s\n", + senderr) } return nil