Class: NewRelic::Control::Frameworks::Rails3

Inherits:
Rails show all
Defined in:
lib/new_relic/control/frameworks/rails3.rb

Overview

Control subclass instantiated when Rails is detected. Contains Rails 3.0+ specific configuration, instrumentation, environment values, etc. Many methods are inherited from the NewRelic::Control::Frameworks::Rails class, where the two do not differ

Direct Known Subclasses

Rails4

Instance Attribute Summary

Attributes included from InstanceMethods

#local_env

Instance Method Summary collapse

Methods inherited from Rails

#install_agent_hooks, #install_browser_monitoring, #install_developer_mode, #rails_config, #rails_version, #root

Methods inherited from Ruby

#root

Methods included from ClassMethods

#instance, #load_framework_class, #load_test_framework, #local_env, #new_instance, #newrelic_root, #reset

Methods included from InstanceMethods

#[], #app, #dispatcher, #framework, #init_plugin, #newrelic_root, #settings, #start_agent

Methods included from LanguageSupport::Control

included

Methods included from Instrumentation

#add_instrumentation, #install_instrumentation, #load_instrumentation_files, #load_samplers

Methods included from ServerMethods

#api_server, #convert_to_ip_address, #proxy_server, #resolve_ip_address, #server, #server_from_host

Methods included from Profiling

#profiling=, #profiling?, #profiling_available?

Instance Method Details

#add_error_collector_middlewareObject



31
32
33
# File 'lib/new_relic/control/frameworks/rails3.rb', line 31

def add_error_collector_middleware
  rails_config.middleware.use NewRelic::Rack::ErrorCollector
end

#envObject



13
14
15
# File 'lib/new_relic/control/frameworks/rails3.rb', line 13

def env
  @env ||= ::Rails.env.to_s
end

#init_config(options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/new_relic/control/frameworks/rails3.rb', line 21

def init_config(options={})
  super
  if Agent.config[:agent_enabled] && Agent.config[:'error_collector.enabled']
    if !rails_config.middleware.respond_to?(:include?) ||
        !rails_config.middleware.include?(NewRelic::Rack::ErrorCollector)
      add_error_collector_middleware
    end
  end
end

#rails_rootObject



17
18
19
# File 'lib/new_relic/control/frameworks/rails3.rb', line 17

def rails_root
  ::Rails.root.to_s
end

#vendor_rootObject



35
36
37
# File 'lib/new_relic/control/frameworks/rails3.rb', line 35

def vendor_root
  @vendor_root ||= File.join(root,'vendor','rails')
end

#versionObject



39
40
41
# File 'lib/new_relic/control/frameworks/rails3.rb', line 39

def version
  @rails_version ||= NewRelic::VersionNumber.new(::Rails::VERSION::STRING)
end