lib/new_relic/control/frameworks/rails.rb in newrelic_rpm-3.4.1 vs lib/new_relic/control/frameworks/rails.rb in newrelic_rpm-3.4.2.beta1

- old
+ new

@@ -20,41 +20,41 @@ def logger ::RAILS_DEFAULT_LOGGER end # In versions of Rails prior to 2.0, the rails config was only available to - # the init.rb, so it had to be passed on from there. This is a best effort to + # the init.rb, so it had to be passed on from there. This is a best effort to # find a config and use that. def init_config(options={}) rails_config = options[:config] if !rails_config && defined?(::Rails) && ::Rails.respond_to?(:configuration) rails_config = ::Rails.configuration end - # Install the dependency detection, + # Install the dependency detection, if rails_config && ::Rails.configuration.respond_to?(:after_initialize) rails_config.after_initialize do # This will insure we load all the instrumentation as late as possible. If the agent - # is not enabled, it will load a limited amount of instrumentation. See + # is not enabled, it will load a limited amount of instrumentation. See # delayed_job_injection.rb DependencyDetection.detect! end - end - if !agent_enabled? + end + if !Agent.config[:agent_enabled] # Might not be running if it does not think mongrel, thin, passenger, etc # is running, if it things it's a rake task, or if the agent_enabled is false. log! "New Relic Agent not running." else log! "Starting the New Relic Agent." - install_developer_mode rails_config if developer_mode? + install_developer_mode rails_config if Agent.config[:developer_mode] install_browser_monitoring(rails_config) end end def install_browser_monitoring(config) return if @browser_monitoring_installed @browser_monitoring_installed = true - return if config.nil? || !config.respond_to?(:middleware) || ! browser_monitoring_auto_instrument? + return if config.nil? || !config.respond_to?(:middleware) || !Agent.config[:'browser_monitoring.auto_instrument'] begin require 'new_relic/rack/browser_monitoring' config.middleware.use NewRelic::Rack::BrowserMonitoring log!("Installed New Relic Browser Monitoring middleware", :info) rescue => e @@ -112,10 +112,10 @@ def rails_vendor_root File.join(root,'vendor','rails') end def rails_gem_list - ::Rails.configuration.gems.map do | gem | + ::Rails.configuration.gems.map do |gem| version = (gem.respond_to?(:version) && gem.version) || (gem.specification.respond_to?(:version) && gem.specification.version) gem.name + (version ? "(#{version})" : "") end end