Just close Riemann client on send metrics failure

Signed-off-by: Eugene Chupriyanov <e.chupriyanov@cpm.ru>

closes #1013
This commit is contained in:
Eugene Chupriyanov
2016-04-19 01:08:18 +03:00
committed by Cameron Sparr
parent 708a97d773
commit c737a19d9f
2 changed files with 3 additions and 9 deletions

View File

@@ -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