Class: NewRelic::Control::Frameworks::Ruby
- Inherits:
-
NewRelic::Control
- Object
- NewRelic::Control
- NewRelic::Control::Frameworks::Ruby
- Defined in:
- lib/new_relic/control/frameworks/ruby.rb
Overview
A control used when no framework is detected - the default. Looks for a newrelic.yml file in several locations including ./, ./config, $HOME/.newrelic and $HOME/. It loads the settings from the newrelic.yml section based on the value of RUBY_ENV or RAILS_ENV.
Instance Attribute Summary
Attributes included from InstanceMethods
Attributes included from LoggingMethods
Instance Method Summary collapse
-
#config_file ⇒ Object
Check a sequence of file locations for newrelic.yml.
- #env ⇒ Object
- #init_config(options = {}) ⇒ Object
- #root ⇒ Object
- #to_stdout(msg) ⇒ Object
Methods included from ClassMethods
#instance, #load_framework_class, #load_test_framework, #local_env, #new_instance, #newrelic_root
Methods included from InstanceMethods
#[], #app, #dispatcher, #init_plugin, #settings, #start_agent, #to_s
Methods included from LanguageSupport::Control
Methods included from LoggingMethods
#find_or_create_file_path, #log, #log!, #log_path, #log_to_stdout?, #set_log_format!, #set_log_level!, #setup_log, #should_log?
Methods included from Instrumentation
#add_instrumentation, #install_instrumentation, #install_shim, #load_instrumentation_files, #load_samplers
Methods included from ServerMethods
#api_server, #cert_file_path, #convert_to_ip_address, #http_connection, #proxy_server, #resolve_ip_address, #server, #server_from_host
Methods included from Profiling
#profiling=, #profiling?, #profiling_available?
Instance Method Details
#config_file ⇒ Object
Check a sequence of file locations for newrelic.yml
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/new_relic/control/frameworks/ruby.rb', line 18 def config_file files = [] files << File.join(root,"config","newrelic.yml") files << File.join(root,"newrelic.yml") if ENV["HOME"] files << File.join(ENV["HOME"], ".newrelic", "newrelic.yml") files << File.join(ENV["HOME"], "newrelic.yml") end files << File.(ENV["NRCONFIG"]) if ENV["NRCONFIG"] files.each do |file| return File.(file) if File.exists? file end return File.(files.first) end |
#env ⇒ Object
11 12 13 |
# File 'lib/new_relic/control/frameworks/ruby.rb', line 11 def env @env ||= ENV['RUBY_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development' end |
#init_config(options = {}) ⇒ Object
36 37 |
# File 'lib/new_relic/control/frameworks/ruby.rb', line 36 def init_config(={}) end |
#root ⇒ Object
14 15 16 |
# File 'lib/new_relic/control/frameworks/ruby.rb', line 14 def root @root ||= ENV['APP_ROOT'] || '.' end |
#to_stdout(msg) ⇒ Object
32 33 34 |
# File 'lib/new_relic/control/frameworks/ruby.rb', line 32 def to_stdout(msg) STDOUT.puts msg end |