class OneApm::Configuration::DefaultSource

Attributes

defaults[R]

Public Class Methods

agent_enabled() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 85
def self.agent_enabled
  Proc.new {
    OneApm::Manager.config[:enabled] &&
    OneApm::Manager.config[:monitor_mode] &&
    OneApm::Manager.agent_should_start?
  }
end
app_name() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 99
def self.app_name
  Proc.new { OneApm::Probe.instance.env }
end
audit_log_path() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 93
def self.audit_log_path
  Proc.new {
    File.join(OneApm::Manager.config[:log_file_path], 'oneapm_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/one_apm/configuration/default_source.rb, line 125
def self.browser_monitoring_loader
  Proc.new { OneApm::Manager.config[:js_errors_beta] ? "full" : "rum"}
end
config_path() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 51
def self.config_path
  Proc.new {
    found_path = OneApm::Manager.config[:config_search_paths].detect do |file|
      File.expand_path(file) if File.exists? file
    end
    found_path || ""
  }
end
config_search_paths() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 37
def self.config_search_paths
  Proc.new {
    paths = [File.join(OneApm::Probe.instance.root, "config", "oneapm.yml")]

    # JRuby war
    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", "oneapm.yml")
    end

    paths
  }
end
convert_to_list(value) click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 147
def self.convert_to_list(value)
  case value
  when String
    value.split(',')
  when Array
    value
  else
    raise ArgumentError.new("Config value '#{value}' couldn't be turned into a list.")
  end
end
dispatcher() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 103
def self.dispatcher
  Proc.new { OneApm::Probe.instance.local_env.discovered_dispatcher }
end
framework() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 60
def self.framework
  Proc.new {
    case
    when defined?(::OneApm::TEST) then :test
    when defined?(::Rails::VERSION)
      case Rails::VERSION::MAJOR
      when 0..2
        :rails
      when 3
        :rails3
      when 4
        :rails4
      when 5
        :rails5
      else
        OneApm::Manager.logger.error "Detected unsupported Rails version #{Rails::VERSION::STRING}"
        :rails
      end
    when defined?(::Sinatra) && defined?(::Sinatra::Base) then :sinatra
    when defined?(::OneApm::IA) then :external
    else :ruby
    end
  }
end
marshaller() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 107
def self.marshaller
  Proc.new { OneApm::Support::JsonMarshaller.is_supported? ? 'json' : 'pruby' }
end
new() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 20
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/one_apm/configuration/default_source.rb, line 114
def self.normalize_json_string_encodings
  Proc.new { OneApm::LanguageSupport.supports_string_encodings? }
end
port() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 133
def self.port
  Proc.new { OneApm::Manager.config[:ssl] ? 443 : 80 }
end
rules_ignore() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 137
def self.rules_ignore
  Proc.new do |rules|
    rules = convert_to_list(rules)

    rules.map do |rule|
      /#{rule}/
    end
  end
end
thread_profiler_enabled() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 118
def self.thread_profiler_enabled
  Proc.new { OneApm::Agent::Threading::BacktraceService.is_supported? }
end
transaction_tracer_transaction_threshold() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 129
def self.transaction_tracer_transaction_threshold
  Proc.new { OneApm::Manager.config[:apdex_t] * 4 }
end
transform_for(key) click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 32
def self.transform_for(key)
  default_settings = ::OneApm::Configuration::DEFAULTS[key]
  default_settings[:transform] if default_settings
end

Public Instance Methods

default_values() click to toggle source
# File lib/one_apm/configuration/default_source.rb, line 24
def default_values
  result = {}
  ::OneApm::Configuration::DEFAULTS.each do |key, value|
    result[key] = value[:default]
  end
  result
end