Just close Riemann client on send metrics failure
Signed-off-by: Eugene Chupriyanov <e.chupriyanov@cpm.ru>
This commit is contained in:
parent
288b8e0a68
commit
ff672f0d6a
|
@ -80,16 +80,9 @@ func (r *Riemann) Write(metrics []telegraf.Metric) error {
|
||||||
var senderr = r.client.SendMulti(events)
|
var senderr = r.client.SendMulti(events)
|
||||||
if senderr != nil {
|
if senderr != nil {
|
||||||
r.Close() // always retuns 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",
|
return fmt.Errorf("FAILED to send riemann message (will try to reconnect). Error: %s\n",
|
||||||
senderr)
|
senderr)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue