Class: NewRelic::Config::Rails
Instance Attribute Summary
#log_file
Instance Method Summary
collapse
#[], #[]=, #api_server, #app_config_info, #app_name, #connect_to_server?, #developer_mode?, #fetch, format_message, #http_connection, instance, #local_env, #log, #log!, #newrelic_root, #proxy_server, #server, #set_config, #settings, #setup_log, #to_s, #tracers_enabled?, #use_ssl?
Instance Method Details
3
|
# File 'lib/new_relic/config/rails.rb', line 3
def app; :rails; end
|
5
6
7
|
# File 'lib/new_relic/config/rails.rb', line 5
def env
@env ||= RAILS_ENV
end
|
#install_developer_mode(rails_config) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/new_relic/config/rails.rb', line 27
def install_developer_mode(rails_config)
controller_path = File.join(newrelic_root, 'ui', 'controllers')
helper_path = File.join(newrelic_root, 'ui', 'helpers')
if defined? ActiveSupport::Dependencies
Dir["#{helper_path}/*.rb"].each { |f| require f }
Dir["#{controller_path}/*.rb"].each { |f| require f }
elsif defined? Dependencies.load_paths
Dependencies.load_paths << controller_path
Dependencies.load_paths << helper_path
else
to_stderr "ERROR: Rails version #{(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : ''} too old for developer mode to work."
return
end
install_devmode_route
if rails_config
rails_config.controller_paths << controller_path
else
current_paths = ActionController::Routing.controller_paths
if current_paths.nil? || current_paths.empty?
to_stderr "WARNING: Unable to modify the routes in this version of Rails. Developer mode not available."
end
current_paths << controller_path
end
if local_env.identifier
port = local_env.identifier.to_s =~ /^\d+/ ? ":#{local_env.identifier}" : ":port"
to_stderr "NewRelic Agent Developer Mode enabled."
to_stderr "To view performance information, go to http://localhost#{port}/newrelic"
end
end
|
12
13
14
15
16
17
|
# File 'lib/new_relic/config/rails.rb', line 12
def log_path
path = ::RAILS_DEFAULT_LOGGER.instance_eval do
File.dirname(@log.path) rescue File.dirname(@logdev.filename)
end rescue "#{root}/log"
File.expand_path(path)
end
|
8
9
10
|
# File 'lib/new_relic/config/rails.rb', line 8
def root
RAILS_ROOT
end
|
#start_plugin(rails_config = nil) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/new_relic/config/rails.rb', line 19
def start_plugin(rails_config=nil)
if !tracers_enabled? || !start_agent
require 'new_relic/shim_agent'
else
install_developer_mode rails_config if developer_mode?
end
end
|