class NewRelic::Agent::Configuration::DefaultSource
Attributes
defaults[R]
Public Class Methods
agent_enabled()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 103 def self.agent_enabled Proc.new { NewRelic::Agent.config[:enabled] && (NewRelic::Agent.config[:developer_mode] || NewRelic::Agent.config[:monitor_mode]) && NewRelic::Agent::Autostart.agent_should_start? } end
app_name()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 117 def self.app_name Proc.new { NewRelic::Control.instance.env } end
audit_log_path()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 111 def self.audit_log_path Proc.new { File.join(NewRelic::Agent.config[:log_file_path], 'newrelic_audit.log') } end
browser_monitoring_loader()
click to toggle source
This check supports the js_errors_beta key we've asked clients to set. Once JS errors are GA, browser_monitoring.loader can stop being dynamic.
# File lib/new_relic/agent/configuration/default_source.rb, line 139 def self.browser_monitoring_loader Proc.new { NewRelic::Agent.config[:js_errors_beta] ? "full" : "rum"} end
config_path()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 69 def self.config_path Proc.new { found_path = NewRelic::Agent.config[:config_search_paths].detect do |file| File.expand_path(file) if File.exist? file end found_path || "" } end
config_search_paths()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 42 def self.config_search_paths Proc.new { paths = [ File.join("config","newrelic.yml"), File.join("newrelic.yml") ] if NewRelic::Control.instance.root paths << File.join(NewRelic::Control.instance.root, "config", "newrelic.yml") paths << File.join(NewRelic::Control.instance.root, "newrelic.yml") end if ENV["HOME"] paths << File.join(ENV["HOME"], ".newrelic", "newrelic.yml") paths << File.join(ENV["HOME"], "newrelic.yml") end # If we're packaged for warbler, we can tell from GEM_HOME if ENV["GEM_HOME"] && ENV["GEM_HOME"].end_with?(".jar!") app_name = File.basename(ENV["GEM_HOME"], ".jar!") paths << File.join(ENV["GEM_HOME"], app_name, "config", "newrelic.yml") end paths } end
convert_to_constant_list(raw_value)
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 180 def self.convert_to_constant_list(raw_value) const_names = convert_to_list(raw_value) const_names.map! do |class_name| const = ::NewRelic::LanguageSupport.constantize(class_name) unless const NewRelic::Agent.logger.warn("Ignoring unrecognized constant '#{class_name}' in #{raw_value}") end const end const_names.compact end
convert_to_list(value)
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 169 def self.convert_to_list(value) case value when String value.split(/\s*,\s*/) when Array value else raise ArgumentError.new("Config value '#{value}' couldn't be turned into a list.") end end
convert_to_regexp_list(raw_value)
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 162 def self.convert_to_regexp_list(raw_value) value_list = convert_to_list(raw_value) value_list.map do |value| /#{value}/ end end
dispatcher()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 121 def self.dispatcher Proc.new { NewRelic::Control.instance.local_env.discovered_dispatcher } end
framework()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 78 def self.framework Proc.new { case when defined?(::NewRelic::TEST) then :test when defined?(::Merb) && defined?(::Merb::Plugins) then :merb when defined?(::Rails::VERSION) case Rails::VERSION::MAJOR when 0..2 :rails when 3 :rails3 when 4 :rails4 when 5 :rails5 else ::NewRelic::Agent.logger.error "Detected unsupported Rails version #{Rails::VERSION::STRING}" end when defined?(::Sinatra) && defined?(::Sinatra::Base) then :sinatra when defined?(::NewRelic::IA) then :external else :ruby end } end
new()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 25 def initialize @defaults = default_values end
normalize_json_string_encodings()
click to toggle source
On Rubies with string encodings support (1.9.x+), default to always normalize encodings since it's safest and fast. Without that support the conversions are too expensive, so only enable if overridden to.
# File lib/new_relic/agent/configuration/default_source.rb, line 128 def self.normalize_json_string_encodings Proc.new { NewRelic::LanguageSupport.supports_string_encodings? } end
port()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 147 def self.port Proc.new { NewRelic::Agent.config[:ssl] ? 443 : 80 } end
profiling_available()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 151 def self.profiling_available Proc.new { begin require 'ruby-prof' true rescue LoadError false end } end
thread_profiler_enabled()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 132 def self.thread_profiler_enabled Proc.new { NewRelic::Agent::Threading::BacktraceService.is_supported? } end
transaction_tracer_transaction_threshold()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 143 def self.transaction_tracer_transaction_threshold Proc.new { NewRelic::Agent.config[:apdex_t] * 4 } end
transform_for(key)
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 37 def self.transform_for(key) default_settings = ::NewRelic::Agent::Configuration::DEFAULTS[key] default_settings[:transform] if default_settings end
Public Instance Methods
default_values()
click to toggle source
# File lib/new_relic/agent/configuration/default_source.rb, line 29 def default_values result = {} ::NewRelic::Agent::Configuration::DEFAULTS.each do |key, value| result[key] = value[:default] end result end