lib/instrumental/agent.rb in instrumental_agent-0.12.0 vs lib/instrumental/agent.rb in instrumental_agent-0.12.1
- old
+ new
@@ -233,12 +233,11 @@
increment "agent.invalid_value"
logger.warn "Invalid value #{value.inspect} for #{metric}"
end
def report_exception(e)
- logger.error "Exception occurred: #{e.message}"
- logger.error e.backtrace.join("\n")
+ logger.error "Exception occurred: #{e.message}\n#{e.backtrace.join("\n")}"
end
def send_command(cmd, *args)
if enabled?
start_connection_worker if !running?
@@ -341,14 +340,19 @@
sync_resource.signal
end
end
end
rescue Exception => err
- logger.error "Instrumental Error: #{err}"
- logger.error err.backtrace.join("\n")
+ if err.is_a?(EOFError)
+ # nop
+ elsif err.is_a?(Errno::ECONNREFUSED)
+ logger.error "unable to connect to Instrumental."
+ else
+ report_exception(err)
+ end
if @allow_reconnect == false ||
(command_options && command_options[:allow_reconnect] == false)
- logger.error "Not trying to reconnect"
+ logger.info "Not trying to reconnect"
return
end
if command_and_args
logger.debug "requeueing: #{command_and_args}"
@queue << command_and_args