class TingYun::Configuration::DefaultSource
Attributes
defaults[R]
Public Class Methods
action_tracer_action_threshold()
click to toggle source
# File lib/ting_yun/configuration/default_source.rb, line 106 def self.action_tracer_action_threshold Proc.new { TingYun::Agent.config[:apdex_t] * 4 } end
app_name()
click to toggle source
# File lib/ting_yun/configuration/default_source.rb, line 98 def self.app_name Proc.new { ::TingYun::Frameworks.framework.env } end
config_path()
click to toggle source
# File lib/ting_yun/configuration/default_source.rb, line 64 def self.config_path Proc.new { found_path = TingYun::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/ting_yun/configuration/default_source.rb, line 110 def self.config_search_paths Proc.new { paths = [ File.join("config", "tingyun.yml"), File.join("tingyun.yml") ] if ::TingYun::Frameworks.framework.root paths << File.join(::TingYun::Frameworks.framework.root, "config", "tingyun.yml") paths << File.join(::TingYun::Frameworks.framework.root, "tingyun.yml") end if ENV["HOME"] paths << File.join(ENV["HOME"], ".tingyun", "tingyun.yml") paths << File.join(ENV["HOME"], "tingyun.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", "tingyun.yml") end paths } end
dispatcher()
click to toggle source
# File lib/ting_yun/configuration/default_source.rb, line 86 def self.dispatcher Proc.new { ::TingYun::Frameworks.framework.local_env.discovered_dispatcher } end
empty_array()
click to toggle source
# File lib/ting_yun/configuration/default_source.rb, line 73 def self.empty_array Proc.new { [] } end
framework()
click to toggle source
# File lib/ting_yun/configuration/default_source.rb, line 34 def self.framework Proc.new { case when defined?(::TingYun::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 ::TingYun::Agent.logger.error "Detected unsupported Rails version #{Rails::VERSION::STRING}" end when defined?(::Sinatra) && defined?(::Sinatra::Base) then :sinatra when defined?(::TingYun::IA) then :external else :ruby end } end
new()
click to toggle source
# File lib/ting_yun/configuration/default_source.rb, line 30 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/ting_yun/configuration/default_source.rb, line 93 def self.normalize_json_string_encodings Proc.new { TingYun::Support::LanguageSupport.supports_string_encodings? } end
port()
click to toggle source
# File lib/ting_yun/configuration/default_source.rb, line 102 def self.port Proc.new { TingYun::Agent.config[:ssl] ? 443 : 80 } end
Public Instance Methods
default_values()
click to toggle source
# File lib/ting_yun/configuration/default_source.rb, line 78 def default_values result = {} ::TingYun::Configuration::DEFAULTS.each do |key, value| result[key] = value[:default] end result end