53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/fluent/plugin/graphite.rb', line 53
def post(metric, time)
trial ||= 1
@client.metrics(metric, time)
log.debug("Sending metric: #{metric}")
rescue Errno::ETIMEDOUT
if trial <= @max_retries
log.warn "out_graphite: connection timeout to #{@host}:#{@port}. Reconnecting... "
trial += 1
::Graphite.init_client(@log_level, @host, @port)
retry
else
log.error "out_graphite: ERROR: connection timeout to #{@host}:#{@port}. Exceeded max_retries #{@max_retries}"
end
rescue Errno::ECONNREFUSED
log.warn "out_graphite: connection refused by #{@host}:#{@port}"
rescue SocketError => se
log.warn "out_graphite: socket error by #{@host}:#{@port} :#{se}"
rescue StandardError => e
log.error "out_graphite: ERROR: #{e}"
end
|