lib/new_relic/agent/agent.rb in newrelic_rpm-2.8.8 vs lib/new_relic/agent/agent.rb in newrelic_rpm-2.8.9
- old
+ new
@@ -545,16 +545,19 @@
retry
end
end
def load_samplers
- sampler_files = File.join(File.dirname(__FILE__), 'samplers', '*.rb')
- Dir.glob(sampler_files) do |file|
+ sampler_files_root = File.join(File.dirname(__FILE__), 'samplers')
+ samplers = %w[memory.rb]
+ samplers += %w[cpu.rb mongrel.rb] unless RUBY_PLATFORM =~ /java/
+ for sampler in samplers do
begin
- require file
+ log.debug "Loading sampler #{sampler}"
+ require File.join(sampler_files_root, sampler)
rescue => e
- log.error "Error loading sampler '#{file}': #{e}"
+ log.error "Error loading sampler '#{sampler}': #{e}"
end
end
end
def determine_host
@@ -664,10 +667,10 @@
# params = {:method => method, :license_key => license_key, :protocol_version => PROTOCOL_VERSION }
# uri = "/agent_listener/invoke_raw_method?#{params.to_query}"
uri = "/agent_listener/invoke_raw_method?method=#{method}&license_key=#{license_key}&protocol_version=#{PROTOCOL_VERSION}"
uri += "&run_id=#{@agent_id}" if @agent_id
- request = Net::HTTP::Post.new(uri, 'ACCEPT-ENCODING' => 'gzip')
+ request = Net::HTTP::Post.new(uri, 'ACCEPT-ENCODING' => 'gzip', 'HOST' => config.fetch('host', 'collector.newrelic.com'))
request.content_type = "application/octet-stream"
request.body = post_data
log.debug "#{uri}"