Module: OneApm::Probe::InstanceMethods
- Included in:
- OneApm::Probe
- Defined in:
- lib/one_apm/probe/instance_methods.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
writeonly
Sets the attribute env.
-
#local_env ⇒ Object
readonly
Returns the value of attribute local_env.
Instance Method Summary collapse
- #app ⇒ Object
- #configure_agent(env, options) ⇒ Object
- #dispatcher ⇒ Object
- #framework ⇒ Object
- #init_plugin(options = {}) ⇒ Object
- #oneapm_root ⇒ Object
- #settings ⇒ Object
-
#start_agent ⇒ Object
Install the real agent into the Agent module, and issue the start command.
Instance Attribute Details
#env=(value) ⇒ Object (writeonly)
Sets the attribute env
11 12 13 |
# File 'lib/one_apm/probe/instance_methods.rb', line 11 def env=(value) @env = value end |
#local_env ⇒ Object (readonly)
Returns the value of attribute local_env.
12 13 14 |
# File 'lib/one_apm/probe/instance_methods.rb', line 12 def local_env @local_env end |
Instance Method Details
#app ⇒ Object
70 71 72 |
# File 'lib/one_apm/probe/instance_methods.rb', line 70 def app OneApm::Manager.config[:framework] end |
#configure_agent(env, options) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/one_apm/probe/instance_methods.rb', line 52 def configure_agent(env, ) manual = OneApm::Configuration::ManualSource.new() 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 ⇒ Object
82 83 84 |
# File 'lib/one_apm/probe/instance_methods.rb', line 82 def dispatcher OneApm::Manager.config[:dispatcher] end |
#framework ⇒ Object
74 75 76 |
# File 'lib/one_apm/probe/instance_methods.rb', line 74 def framework OneApm::Manager.config[:framework] end |
#init_plugin(options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/one_apm/probe/instance_methods.rb', line 14 def init_plugin( = {}) env = [:env] || self.env OneApm::Manager.logger.info("Starting the OneAPM Agent (#{OneApm::VERSION::STRING}) in #{env.inspect} environment.") configure_agent(env, ) # Be sure to only create once! RUBY-1020 if OneApm::Manager.logger.is_startup_logger? OneApm::Manager.logger = OneApm::Logger::AgentLogger.new(root, .delete(:log)) end # Merge the stringified options into the config as overrides: environment_name = .delete(:env) and self.env = environment_name OneApm::Support::ForkedProcessChannel.listener.start if .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() # 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 ⇒ Object
86 87 88 |
# File 'lib/one_apm/probe/instance_methods.rb', line 86 def oneapm_root OneApm::Probe.oneapm_root end |