newrelic_rpm 3.4.1 → 3.4.2.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of newrelic_rpm might be problematic. Click here for more details.

Files changed (81) hide show
  1. data/CHANGELOG +7 -0
  2. data/ReleaseNotes.md +638 -0
  3. data/lib/new_relic/agent/agent.rb +44 -56
  4. data/lib/new_relic/agent/beacon_configuration.rb +1 -1
  5. data/lib/new_relic/agent/browser_monitoring.rb +80 -42
  6. data/lib/new_relic/agent/configuration/defaults.rb +75 -0
  7. data/lib/new_relic/agent/configuration/environment_source.rb +42 -0
  8. data/lib/new_relic/agent/configuration/manager.rb +100 -0
  9. data/lib/new_relic/agent/configuration/server_source.rb +24 -0
  10. data/lib/new_relic/agent/configuration/yaml_source.rb +61 -0
  11. data/lib/new_relic/agent/configuration.rb +48 -0
  12. data/lib/new_relic/agent/error_collector.rb +10 -14
  13. data/lib/new_relic/agent/instrumentation/active_record.rb +1 -5
  14. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +20 -4
  15. data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +1 -1
  16. data/lib/new_relic/agent/instrumentation/memcache.rb +2 -2
  17. data/lib/new_relic/agent/instrumentation/metric_frame.rb +1 -1
  18. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +3 -3
  19. data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +2 -2
  20. data/lib/new_relic/agent/instrumentation/resque.rb +1 -1
  21. data/lib/new_relic/agent/method_tracer.rb +1 -1
  22. data/lib/new_relic/agent/new_relic_service.rb +18 -9
  23. data/lib/new_relic/agent/pipe_channel_manager.rb +5 -6
  24. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +2 -5
  25. data/lib/new_relic/agent/sql_sampler.rb +11 -35
  26. data/lib/new_relic/agent/stats_engine/transactions.rb +2 -2
  27. data/lib/new_relic/agent/transaction_info.rb +24 -4
  28. data/lib/new_relic/agent/transaction_sample_builder.rb +2 -3
  29. data/lib/new_relic/agent/transaction_sampler.rb +9 -16
  30. data/lib/new_relic/agent.rb +4 -1
  31. data/lib/new_relic/collection_helper.rb +1 -1
  32. data/lib/new_relic/commands/deployments.rb +5 -3
  33. data/lib/new_relic/control/class_methods.rb +2 -3
  34. data/lib/new_relic/control/frameworks/rails.rb +8 -8
  35. data/lib/new_relic/control/frameworks/ruby.rb +2 -2
  36. data/lib/new_relic/control/instance_methods.rb +26 -32
  37. data/lib/new_relic/control/logging_methods.rb +5 -23
  38. data/lib/new_relic/control/server_methods.rb +11 -18
  39. data/lib/new_relic/control.rb +0 -1
  40. data/lib/new_relic/delayed_job_injection.rb +1 -1
  41. data/lib/new_relic/language_support.rb +8 -0
  42. data/lib/new_relic/noticed_error.rb +1 -1
  43. data/lib/new_relic/rack/browser_monitoring.rb +18 -6
  44. data/lib/new_relic/version.rb +2 -2
  45. data/newrelic.yml +0 -4
  46. data/newrelic_rpm.gemspec +16 -6
  47. data/test/config/newrelic.yml +3 -2
  48. data/test/new_relic/agent/agent/connect_test.rb +88 -83
  49. data/test/new_relic/agent/agent/start_test.rb +75 -80
  50. data/test/new_relic/agent/agent/start_worker_thread_test.rb +18 -18
  51. data/test/new_relic/agent/beacon_configuration_test.rb +13 -11
  52. data/test/new_relic/agent/browser_monitoring_test.rb +69 -14
  53. data/test/new_relic/agent/configuration/environment_source_test.rb +58 -0
  54. data/test/new_relic/agent/configuration/manager_test.rb +120 -0
  55. data/test/new_relic/agent/configuration/server_source_test.rb +28 -0
  56. data/test/new_relic/agent/configuration/yaml_source_test.rb +56 -0
  57. data/test/new_relic/agent/error_collector/notice_error_test.rb +63 -50
  58. data/test/new_relic/agent/error_collector_test.rb +10 -12
  59. data/test/new_relic/agent/new_relic_service_test.rb +11 -3
  60. data/test/new_relic/agent/pipe_channel_manager_test.rb +19 -16
  61. data/test/new_relic/agent/rpm_agent_test.rb +21 -19
  62. data/test/new_relic/agent/sql_sampler_test.rb +55 -56
  63. data/test/new_relic/agent/transaction_info_test.rb +45 -4
  64. data/test/new_relic/agent/transaction_sampler_test.rb +48 -44
  65. data/test/new_relic/agent_test.rb +68 -41
  66. data/test/new_relic/collection_helper_test.rb +7 -8
  67. data/test/new_relic/command/deployments_test.rb +12 -1
  68. data/test/new_relic/control/frameworks/rails_test.rb +26 -0
  69. data/test/new_relic/control/logging_methods_test.rb +77 -52
  70. data/test/new_relic/control_test.rb +103 -126
  71. data/test/new_relic/local_environment_test.rb +4 -6
  72. data/test/new_relic/rack/browser_monitoring_test.rb +4 -4
  73. data/test/new_relic/rack/developer_mode_test.rb +13 -7
  74. data/test/new_relic/transaction_sample_test.rb +8 -2
  75. data/test/script/build_test_gem.sh +9 -3
  76. data/test/script/ci.sh +13 -3
  77. data/test/test_helper.rb +9 -2
  78. data/ui/helpers/developer_mode_helper.rb +2 -7
  79. metadata +26 -11
  80. data/lib/new_relic/control/configuration.rb +0 -206
  81. data/test/new_relic/control/configuration_test.rb +0 -77
@@ -90,6 +90,7 @@ module NewRelic
90
90
  require 'new_relic/agent/database'
91
91
  require 'new_relic/agent/pipe_channel_manager'
92
92
  require 'new_relic/agent/transaction_info'
93
+ require 'new_relic/agent/configuration'
93
94
 
94
95
  require 'new_relic/agent/instrumentation/controller_instrumentation'
95
96
 
@@ -100,7 +101,9 @@ module NewRelic
100
101
  require 'set'
101
102
  require 'thread'
102
103
  require 'resolv'
103
-
104
+
105
+ extend NewRelic::Agent::Configuration::Instance
106
+
104
107
  # An exception that is thrown by the server if the agent license is invalid.
105
108
  class LicenseException < StandardError; end
106
109
 
@@ -33,7 +33,7 @@ module NewRelic
33
33
  # Return nil if there is no backtrace
34
34
 
35
35
  def strip_nr_from_backtrace(backtrace)
36
- if backtrace && !NewRelic::Control.instance.disable_backtrace_cleanup?
36
+ if backtrace && !Agent.config[:disable_backtrace_cleanup]
37
37
  # this is for 1.9.1, where strings no longer have Enumerable
38
38
  backtrace = backtrace.split("\n") if String === backtrace
39
39
  backtrace = backtrace.map &:to_s
@@ -29,7 +29,7 @@ class NewRelic::Command::Deployments < NewRelic::Command
29
29
  @description ||= @leftover && @leftover.join(" ")
30
30
  @user ||= ENV['USER']
31
31
  config.env = @environment if @environment
32
- @appname ||= config.app_names[0] || config.env || 'development'
32
+ @appname ||= NewRelic::Agent.config.app_names[0] || config.env || 'development'
33
33
  end
34
34
 
35
35
  # Run the Deployment upload in New Relic via Active Resource.
@@ -52,8 +52,10 @@ class NewRelic::Command::Deployments < NewRelic::Command
52
52
 
53
53
  uri = "/deployments.xml"
54
54
 
55
- raise "license_key was not set in newrelic.yml for #{config.env}" if config['license_key'].nil?
56
- request = Net::HTTP::Post.new(uri, {'x-license-key' => config['license_key']})
55
+ if NewRelic::Agent.config[:license_key].nil?
56
+ raise "license_key was not set in newrelic.yml for #{config.env}"
57
+ end
58
+ request = Net::HTTP::Post.new(uri, {'x-license-key' => NewRelic::Agent.config[:license_key]})
57
59
  request.content_type = "application/octet-stream"
58
60
 
59
61
  request.set_form_data(create_params)
@@ -8,7 +8,7 @@ module NewRelic
8
8
  def instance(create=true)
9
9
  @instance ||= create && new_instance
10
10
  end
11
-
11
+
12
12
  # Access the LocalEnvironment singleton, lazy initialized
13
13
  def local_env
14
14
  @local_env ||= NewRelic::LocalEnvironment.new
@@ -29,7 +29,7 @@ module NewRelic
29
29
  require "config/test_control"
30
30
  NewRelic::Control::Frameworks::Test.new(local_env, config)
31
31
  end
32
-
32
+
33
33
  # Loads the specified framework class from the
34
34
  # NewRelic::Control::Frameworks module
35
35
  def load_framework_class(framework)
@@ -50,4 +50,3 @@ module NewRelic
50
50
  extend ClassMethods
51
51
  end
52
52
  end
53
-
@@ -22,29 +22,29 @@ module NewRelic
22
22
  end
23
23
 
24
24
  # In versions of Rails prior to 2.0, the rails config was only available to
25
- # the init.rb, so it had to be passed on from there. This is a best effort to
25
+ # the init.rb, so it had to be passed on from there. This is a best effort to
26
26
  # find a config and use that.
27
27
  def init_config(options={})
28
28
  rails_config = options[:config]
29
29
  if !rails_config && defined?(::Rails) && ::Rails.respond_to?(:configuration)
30
30
  rails_config = ::Rails.configuration
31
31
  end
32
- # Install the dependency detection,
32
+ # Install the dependency detection,
33
33
  if rails_config && ::Rails.configuration.respond_to?(:after_initialize)
34
34
  rails_config.after_initialize do
35
35
  # This will insure we load all the instrumentation as late as possible. If the agent
36
- # is not enabled, it will load a limited amount of instrumentation. See
36
+ # is not enabled, it will load a limited amount of instrumentation. See
37
37
  # delayed_job_injection.rb
38
38
  DependencyDetection.detect!
39
39
  end
40
- end
41
- if !agent_enabled?
40
+ end
41
+ if !Agent.config[:agent_enabled]
42
42
  # Might not be running if it does not think mongrel, thin, passenger, etc
43
43
  # is running, if it things it's a rake task, or if the agent_enabled is false.
44
44
  log! "New Relic Agent not running."
45
45
  else
46
46
  log! "Starting the New Relic Agent."
47
- install_developer_mode rails_config if developer_mode?
47
+ install_developer_mode rails_config if Agent.config[:developer_mode]
48
48
  install_browser_monitoring(rails_config)
49
49
  end
50
50
  end
@@ -52,7 +52,7 @@ module NewRelic
52
52
  def install_browser_monitoring(config)
53
53
  return if @browser_monitoring_installed
54
54
  @browser_monitoring_installed = true
55
- return if config.nil? || !config.respond_to?(:middleware) || ! browser_monitoring_auto_instrument?
55
+ return if config.nil? || !config.respond_to?(:middleware) || !Agent.config[:'browser_monitoring.auto_instrument']
56
56
  begin
57
57
  require 'new_relic/rack/browser_monitoring'
58
58
  config.middleware.use NewRelic::Rack::BrowserMonitoring
@@ -114,7 +114,7 @@ module NewRelic
114
114
  end
115
115
 
116
116
  def rails_gem_list
117
- ::Rails.configuration.gems.map do | gem |
117
+ ::Rails.configuration.gems.map do |gem|
118
118
  version = (gem.respond_to?(:version) && gem.version) ||
119
119
  (gem.specification.respond_to?(:version) && gem.specification.version)
120
120
  gem.name + (version ? "(#{version})" : "")
@@ -12,7 +12,7 @@ module NewRelic
12
12
  @env ||= ENV['RUBY_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
13
13
  end
14
14
  def root
15
- @root ||= ENV['APP_ROOT'] || Dir['.']
15
+ @root ||= ENV['APP_ROOT'] || '.'
16
16
  end
17
17
  # Check a sequence of file locations for newrelic.yml
18
18
  def config_file
@@ -24,7 +24,7 @@ module NewRelic
24
24
  files << File.join(ENV["HOME"], "newrelic.yml")
25
25
  end
26
26
  files << File.expand_path(ENV["NRCONFIG"]) if ENV["NRCONFIG"]
27
- files.each do | file |
27
+ files.each do |file|
28
28
  return File.expand_path(file) if File.exists? file
29
29
  end
30
30
  return File.expand_path(files.first)
@@ -44,6 +44,7 @@ module NewRelic
44
44
  # init_config({}) which is called one or more times.
45
45
  #
46
46
  def init_plugin(options={})
47
+ Agent.config.apply_config(Agent::Configuration::ManualSource.new(options), 1)
47
48
  options['app_name'] = ENV['NEWRELIC_APP_NAME'] if ENV['NEWRELIC_APP_NAME']
48
49
  options['app_name'] ||= ENV['NEW_RELIC_APP_NAME'] if ENV['NEW_RELIC_APP_NAME']
49
50
 
@@ -52,15 +53,9 @@ module NewRelic
52
53
  environment_name = options.delete(:env) and self.env = environment_name
53
54
  dispatcher = options.delete(:dispatcher) and @local_env.dispatcher = dispatcher
54
55
  dispatcher_instance_id = options.delete(:dispatcher_instance_id) and @local_env.dispatcher_instance_id = dispatcher_instance_id
55
-
56
+
56
57
  NewRelic::Agent::PipeChannelManager.listener.start if options.delete(:start_channel_listener)
57
58
 
58
- # Clear out the settings, if they've already been loaded. It may be that
59
- # between calling init_plugin the first time and the second time, the env
60
- # has been overridden
61
- @settings = nil
62
- settings
63
- merge_options(options)
64
59
  if logger_override
65
60
  @log = logger_override
66
61
  # Try to grab the log filename
@@ -72,14 +67,14 @@ module NewRelic
72
67
  Module.send :include, NewRelic::Agent::MethodTracer::InstanceMethods
73
68
  init_config(options)
74
69
  NewRelic::Agent.agent = NewRelic::Agent::Agent.instance
75
- if agent_enabled? && !NewRelic::Agent.instance.started?
70
+ if Agent.config[:agent_enabled] && !NewRelic::Agent.instance.started?
76
71
  setup_log unless logger_override
77
72
  start_agent
78
73
  install_instrumentation
79
- load_samplers unless self['disable_samplers']
74
+ load_samplers unless Agent.config['disable_samplers']
80
75
  local_env.gather_environment_info
81
76
  append_environment_info
82
- elsif !agent_enabled?
77
+ elsif !Agent.config[:agent_enabled]
83
78
  install_shim
84
79
  end
85
80
  end
@@ -89,42 +84,40 @@ module NewRelic
89
84
  NewRelic::Agent.agent.start
90
85
  end
91
86
 
92
- # True if dev mode or monitor mode are enabled, and we are running
93
- # inside a valid dispatcher like mongrel or passenger. Can be overridden
94
- # by NEWRELIC_ENABLE env variable, monitor_daemons config option when true, or
95
- # agent_enabled config option when true or false.
96
- def agent_enabled?
97
- return false if !developer_mode? && !monitor_mode?
98
- return self['agent_enabled'].to_s =~ /true|on|yes/i if !self['agent_enabled'].nil? && self['agent_enabled'] != 'auto'
99
- return false if ENV['NEWRELIC_ENABLE'].to_s =~ /false|off|no/i
100
- return true if self['monitor_daemons'].to_s =~ /true|on|yes/i
101
- return true if ENV['NEWRELIC_ENABLE'].to_s =~ /true|on|yes/i
102
- # When in 'auto' mode the agent is enabled if there is a known
103
- # dispatcher running
104
- return true if @local_env.dispatcher != nil
105
- end
106
-
107
87
  # Asks the LocalEnvironment instance which framework should be loaded
108
88
  def app
109
89
  @local_env.framework
110
90
  end
111
91
  alias framework app
112
-
92
+
113
93
  def to_s #:nodoc:
114
94
  "Control[#{self.app}]"
115
95
  end
116
96
 
97
+ # for backward compatibility with the old config interface
98
+ def [](key)
99
+ NewRelic::Agent.config[key.to_sym]
100
+ end
101
+
102
+ def settings
103
+ NewRelic::Agent.config.flattened_config
104
+ end
105
+
106
+ def dispatcher
107
+ NewRelic::Agent.config[:dispatcher]
108
+ end
109
+
117
110
  protected
118
111
 
119
112
  # Append framework specific environment information for uploading to
120
113
  # the server for change detection. Override in subclasses
121
114
  def append_environment_info; end
122
-
115
+
123
116
  # Asks bundler to tell us which gemspecs are loaded in the
124
117
  # current process
125
118
  def bundler_gem_list
126
119
  if defined?(Bundler) && Bundler.instance_eval do @load end
127
- Bundler.load.specs.map do | spec |
120
+ Bundler.load.specs.map do |spec|
128
121
  version = (spec.respond_to?(:version) && spec.version)
129
122
  spec.name + (version ? "(#{version})" : "")
130
123
  end
@@ -132,12 +125,12 @@ module NewRelic
132
125
  []
133
126
  end
134
127
  end
135
-
128
+
136
129
  # path to the config file, defaults to the "#{root}/config/newrelic.yml"
137
130
  def config_file
138
131
  File.expand_path(File.join(root,"config","newrelic.yml"))
139
132
  end
140
-
133
+
141
134
  # initializes the control instance with a local environment and
142
135
  # an optional config file override. Checks for the config file
143
136
  # and loads it.
@@ -160,11 +153,12 @@ module NewRelic
160
153
  new_err.set_backtrace(e.backtrace)
161
154
  raise new_err
162
155
  end
163
-
156
+
164
157
  def load_newrelic_yml(path, binding)
158
+ Agent.config.apply_config(Agent::Configuration::YamlSource.new(path, env), 1)
165
159
  YAML.load(ERB.new(File.read(path)).result(binding))
166
160
  end
167
-
161
+
168
162
  def root
169
163
  '.'
170
164
  end
@@ -32,7 +32,7 @@ module NewRelic
32
32
  # true if the agent has settings, and the agent is enabled,
33
33
  # otherwise false
34
34
  def should_log?
35
- @settings && agent_enabled?
35
+ @settings && Agent.config[:agent_enabled]
36
36
  end
37
37
 
38
38
  # set the log level as specified in the config file
@@ -41,7 +41,7 @@ module NewRelic
41
41
  #error, and fatal
42
42
  # Defaults to info
43
43
  def set_log_level!(logger)
44
- case fetch("log_level","info").downcase
44
+ case Agent.config[:log_level].downcase
45
45
  when "debug" then logger.level = Logger::DEBUG
46
46
  when "info" then logger.level = Logger::INFO
47
47
  when "warn" then logger.level = Logger::WARN
@@ -68,7 +68,7 @@ module NewRelic
68
68
  if log_to_stdout?
69
69
  @log = Logger.new(STDOUT)
70
70
  else
71
- @log_file = "#{log_path}/#{log_file_name}"
71
+ @log_file = "#{log_path}/#{Agent.config[:log_file_name]}"
72
72
  @log = Logger.new(@log_file) rescue nil
73
73
  @log ||= Logger.new(STDOUT) # failsafe to STDOUT
74
74
  end
@@ -99,11 +99,7 @@ module NewRelic
99
99
  if log_to_stdout?
100
100
  @log_path = nil
101
101
  else
102
- if ENV['NEW_RELIC_LOG']
103
- log_path_setting = File.dirname(ENV['NEW_RELIC_LOG'])
104
- else
105
- log_path_setting = fetch('log_file_path', 'log')
106
- end
102
+ log_path_setting = Agent.config[:log_file_path]
107
103
  @log_path = find_or_create_file_path(log_path_setting)
108
104
  log!("Error creating log directory #{log_path_setting}, using standard out for logging.", :warn) unless @log_path
109
105
  end
@@ -121,21 +117,7 @@ module NewRelic
121
117
  end
122
118
 
123
119
  def log_to_stdout?
124
- return true if @stdout
125
- destination = ENV['NEW_RELIC_LOG'] || fetch('log_file_path', 'log')
126
- if destination.upcase == 'STDOUT'
127
- @stdout = true
128
- end
129
- end
130
-
131
- # Retrieves the log file's name from the config file option
132
- #'log_file_name', defaulting to 'newrelic_agent.log'
133
- def log_file_name
134
- if ENV['NEW_RELIC_LOG']
135
- File.basename(ENV['NEW_RELIC_LOG'])
136
- else
137
- fetch('log_file_name', 'newrelic_agent.log')
138
- end
120
+ Agent.config['log_file_path'].upcase == 'STDOUT'
139
121
  end
140
122
  end
141
123
  include LoggingMethods
@@ -18,34 +18,27 @@ module NewRelic
18
18
  # the server we should contact for api requests, like uploading
19
19
  # deployments and the like
20
20
  def api_server
21
- api_host = self['api_host'] || 'rpm.newrelic.com'
22
- @api_server ||=
23
- NewRelic::Control::Server.new \
24
- api_host,
25
- (self['api_port'] || self['port'] || (use_ssl? ? 443 : 80)).to_i,
26
- nil
21
+ @api_server ||= NewRelic::Control::Server.new(Agent.config[:api_host], Agent.config[:api_port], nil)
27
22
  end
28
23
 
29
24
  # a new instances of the proxy server - this passes through if
30
25
  # there is no proxy, otherwise it has proxy configuration
31
26
  # information pulled from the config file
32
27
  def proxy_server
33
- @proxy_server ||=
34
- NewRelic::Control::ProxyServer.new(self['proxy_host'],
35
- self['proxy_port'],
36
- self['proxy_user'],
37
- self['proxy_pass'])
28
+ @proxy_server ||= NewRelic::Control::ProxyServer.new(Agent.config[:proxy_host],
29
+ Agent.config[:proxy_port],
30
+ Agent.config[:proxy_user],
31
+ Agent.config[:proxy_pass])
38
32
  end
39
33
 
40
34
  # turns a hostname into an ip address and returns a
41
35
  # NewRelic::Control::Server that contains the configuration info
42
36
  def server_from_host(hostname=nil)
43
- host = hostname || self['host'] || 'collector.newrelic.com'
37
+ host = hostname || Agent.config[:host]
44
38
 
45
39
  # if the host is not an IP address, turn it into one
46
- NewRelic::Control::Server.new(host,
47
- (self['port'] || (use_ssl? ? 443 : 80)).to_i,
48
- convert_to_ip_address(host))
40
+ NewRelic::Control::Server.new(host, Agent.config[:port],
41
+ convert_to_ip_address(host))
49
42
  end
50
43
 
51
44
  # Check to see if we need to look up the IP address
@@ -55,7 +48,7 @@ module NewRelic
55
48
  def convert_to_ip_address(host)
56
49
  # here we leave it as a host name since the cert verification
57
50
  # needs it in host form
58
- return host if verify_certificate?
51
+ return host if Agent.config[:ssl] && Agent.config[:verify_certificate]
59
52
  return nil if host.nil? || host.downcase == "localhost"
60
53
  ip = resolve_ip_address(host)
61
54
 
@@ -103,9 +96,9 @@ module NewRelic
103
96
  proxy_server.user, proxy_server.password)
104
97
  http = http_class.new(host.ip || host.name, host.port)
105
98
  log.debug("Http Connection opened to #{host.ip||host.name}:#{host.port}")
106
- if use_ssl?
99
+ if Agent.config[:ssl]
107
100
  http.use_ssl = true
108
- if verify_certificate?
101
+ if Agent.config[:verify_certificate]
109
102
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
110
103
  http.ca_file = cert_file_path
111
104
  else
@@ -12,7 +12,6 @@ require 'logger'
12
12
  require 'new_relic/control/frameworks'
13
13
  require 'new_relic/control/profiling'
14
14
  require 'new_relic/control/logging_methods'
15
- require 'new_relic/control/configuration'
16
15
  require 'new_relic/control/server_methods'
17
16
  require 'new_relic/control/instrumentation'
18
17
  require 'new_relic/control/class_methods'
@@ -15,7 +15,7 @@ DependencyDetection.defer do
15
15
  @name = :delayed_job_injection
16
16
 
17
17
  depends_on do
18
- defined?(::Delayed) && defined?(::Delayed::Worker) && !NewRelic::Control.instance['disable_dj']
18
+ defined?(::Delayed) && defined?(::Delayed::Worker) && !NewRelic::Agent.config[:disable_dj]
19
19
  end
20
20
 
21
21
  executes do
@@ -82,6 +82,14 @@ module NewRelic::LanguageSupport
82
82
  end
83
83
  end
84
84
 
85
+ def with_cautious_gc
86
+ if broken_gc?
87
+ with_disabled_gc { yield }
88
+ else
89
+ yield
90
+ end
91
+ end
92
+
85
93
  def using_version?(version)
86
94
  numbers = version.split('.')
87
95
  numbers == ::RUBY_VERSION.split('.')[0, numbers.size]
@@ -20,7 +20,7 @@ class NewRelic::NoticedError
20
20
  self.message = self.message[0..4095] if self.message.length > 4096
21
21
 
22
22
  # obfuscate error message if necessary
23
- if NewRelic::Control.instance.fetch('high_security', false)
23
+ if NewRelic::Agent.config[:high_security]
24
24
  self.message = NewRelic::Agent::Database.obfuscate_sql(self.message)
25
25
  end
26
26