lib/new_relic/agent/agent.rb in newrelic_rpm-3.0.0.beta1 vs lib/new_relic/agent/agent.rb in newrelic_rpm-3.0.0.beta2
- old
+ new
@@ -429,13 +429,13 @@
end
def create_and_run_worker_loop
@worker_loop = WorkerLoop.new
@worker_loop.run(@report_period) do
- harvest_and_send_timeslice_data
harvest_and_send_slowest_sample if @should_send_samples
harvest_and_send_errors if error_collector.enabled
+ harvest_and_send_timeslice_data
end
end
def handle_force_restart(error)
log.info error.message
@@ -718,10 +718,12 @@
def harvest_and_send_timeslice_data
NewRelic::Agent::BusyCalculator.harvest_busy
now = Time.now
+ NewRelic::Agent.instance.stats_engine.get_stats_no_scope('Supportability/invoke_remote').record_data_point(0.0)
+ NewRelic::Agent.instance.stats_engine.get_stats_no_scope('Supportability/invoke_remote/metric_data').record_data_point(0.0)
@unsent_timeslice_data ||= {}
@unsent_timeslice_data = @stats_engine.harvest_timeslice_data(@unsent_timeslice_data, @metric_ids)
begin
@@ -895,10 +897,11 @@
uri
end
# send a message via post
def invoke_remote(method, *args)
+ now = Time.now
#determines whether to zip the data or send plain
post_data, encoding = compress_data(args)
response = send_request({:uri => remote_method_uri(method), :encoding => encoding, :collector => collector, :data => post_data})
@@ -908,9 +911,12 @@
log.info e.message
raise
rescue SystemCallError, SocketError => e
# These include Errno connection errors
raise NewRelic::Agent::ServerConnectionException, "Recoverable error connecting to the server: #{e}"
+ ensure
+ NewRelic::Agent.instance.stats_engine.get_stats_no_scope('Supportability/invoke_remote').record_data_point((Time.now - now).to_f)
+ NewRelic::Agent.instance.stats_engine.get_stats_no_scope('Supportability/invoke_remote/' + method.to_s).record_data_point((Time.now - now).to_f)
end
def graceful_disconnect
if @connected
begin