lib/new_relic/agent/agent.rb in newrelic_rpm-3.5.8.72 vs lib/new_relic/agent/agent.rb in newrelic_rpm-3.6.0.74.beta
- old
+ new
@@ -1,5 +1,9 @@
+# encoding: utf-8
+# This file is distributed under New Relic's license terms.
+# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
+
require 'socket'
require 'net/https'
require 'net/http'
require 'logger'
require 'zlib'
@@ -141,12 +145,11 @@
end
metrics = metric_info.summary_metrics
metrics << metric
metrics.each do |name|
- stats = stats_engine.get_stats_no_scope(name)
- stats.record_data_point(duration_seconds)
+ NewRelic::Agent.record_metric(name, duration_seconds)
end
if is_error
if options['exception']
e = options['exception']
@@ -449,11 +452,11 @@
# If we're using a dispatcher that forks before serving
# requests, we need to wait until the children are forked
# before connecting, otherwise the parent process sends odd data
def using_forking_dispatcher?
- log_if([:passenger, :unicorn].include?(Agent.config[:dispatcher]),
+ log_if([:passenger, :rainbows, :unicorn].include?(Agent.config[:dispatcher]),
:info, "Connecting workers after forking.")
end
# Return true if we're using resque and it hasn't had a chance to (potentially)
# daemonize itself. This avoids hanging when there's a Thread started
@@ -878,12 +881,12 @@
# note - exceptions are logged in invoke_remote. If an exception is encountered here,
# then the metric data is downsampled for another
# transmission later
def harvest_and_send_timeslice_data
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)
+ NewRelic::Agent.record_metric('Supportability/invoke_remote', 0.0)
+ NewRelic::Agent.record_metric('Supportability/invoke_remote/metric_data', 0.0)
harvest_timeslice_data(now)
begin
@service.metric_data(@last_harvest_time.to_f,
now.to_f,
@unsent_timeslice_data)
@@ -1026,11 +1029,11 @@
retry
end
raise e
ensure
NewRelic::Agent::Database.close_connections unless forked?
- @stats_engine.get_stats_no_scope('Supportability/Harvest') \
- .record_data_point((Time.now - now).to_f)
+ duration = (Time.now - now).to_f
+ @stats_engine.record_metrics('Supportability/Harvest', duration)
end
# This method contacts the server to send remaining data and
# let the server know that the agent is shutting down - this
# allows us to do things like accurately set the end of the