module OneApm::Probe::InstanceMethods
Attributes
env[W]
local_env[R]
Public Class Methods
new(local_env, config_file_override = nil)
click to toggle source
# File lib/one_apm/probe/instance_methods.rb, line 91 def initialize(local_env, config_file_override = nil) @local_env = local_env @instrumentation_files = [] @config_file_override = config_file_override end
Public Instance Methods
app()
click to toggle source
# File lib/one_apm/probe/instance_methods.rb, line 69 def app OneApm::Manager.config[:framework] end
configure_agent(env, options)
click to toggle source
# File lib/one_apm/probe/instance_methods.rb, line 52 def configure_agent(env, options) manual = OneApm::Configuration::ManualSource.new(options) OneApm::Manager.config.replace_or_add_config(manual) config_file_path = @config_file_override || OneApm::Manager.config[:config_path] OneApm::Manager.config.replace_or_add_config(OneApm::Configuration::YamlSource.new(config_file_path, env)) if OneApm::Manager.config[:high_security] OneApm::Manager.logger.info("Installing high security configuration based on local configuration") OneApm::Manager.config.replace_or_add_config(OneApm::Configuration::HighSecuritySource.new(Manager.config)) end end
dispatcher()
click to toggle source
# File lib/one_apm/probe/instance_methods.rb, line 81 def dispatcher OneApm::Manager.config[:dispatcher] end
framework()
click to toggle source
# File lib/one_apm/probe/instance_methods.rb, line 73 def framework OneApm::Manager.config[:framework] end
init_plugin(options = {})
click to toggle source
# File lib/one_apm/probe/instance_methods.rb, line 14 def init_plugin(options = {}) env = options[:env] || self.env OneApm::Manager.logger.info("Starting the OneAPM Agent (#{OneApm::VERSION::STRING}) in #{env.inspect} environment.") configure_agent(env, options) # Be sure to only create once! RUBY-1020 if OneApm::Manager.logger.is_startup_logger? OneApm::Manager.logger = OneApm::Logger::AgentLogger.new(root, options.delete(:log)) end # Merge the stringified options into the config as overrides: environment_name = options.delete(:env) and self.env = environment_name OneApm::Support::ForkedProcessChannel.listener.start if options.delete(:start_channel_listener) # An artifact of earlier implementation, we put both #add_method_tracer and #trace_execution # methods in the module methods. Module.send :include, OneApm::Support::MethodTracer::ClassMethods Module.send :include, OneApm::Support::MethodTracer init_config(options) # initialize agent OneApm::Manager.agent = OneApm::Agent::Agent.instance OneApm::Manager.agent.start_service if OneApm::Manager.config[:agent_enabled] && !OneApm::Manager.agent.started? start_agent install_instrumentation elsif !Manager.config[:agent_enabled] install_shim else detect_dependencies end end
oneapm_root()
click to toggle source
# File lib/one_apm/probe/instance_methods.rb, line 85 def oneapm_root OneApm::Probe.oneapm_root end
settings()
click to toggle source
# File lib/one_apm/probe/instance_methods.rb, line 77 def settings OneApm::Manager.config.to_collector_hash end
start_agent()
click to toggle source
Install the real agent into the Agent
module, and issue the start command.
# File lib/one_apm/probe/instance_methods.rb, line 65 def start_agent OneApm::Manager.agent.start end
Protected Instance Methods
root()
click to toggle source
# File lib/one_apm/probe/instance_methods.rb, line 97 def root '.' end