Class: ScoutApm::AppServerLoad
- Inherits:
-
Object
- Object
- ScoutApm::AppServerLoad
- Defined in:
- lib/scout_apm/app_server_load.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(logger = Agent.instance.logger) ⇒ AppServerLoad
constructor
A new instance of AppServerLoad.
- #run ⇒ Object
Constructor Details
#initialize(logger = Agent.instance.logger) ⇒ AppServerLoad
Returns a new instance of AppServerLoad.
5 6 7 |
# File 'lib/scout_apm/app_server_load.rb', line 5 def initialize(logger=Agent.instance.logger) @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
3 4 5 |
# File 'lib/scout_apm/app_server_load.rb', line 3 def logger @logger end |
Instance Method Details
#data ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/scout_apm/app_server_load.rb', line 29 def data { :server_time => Time.now, :framework => ScoutApm::Environment.instance.framework_integration.human_name, :framework_version => ScoutApm::Environment.instance.framework_integration.version, :environment => ScoutApm::Environment.instance.framework_integration.env, :app_server => ScoutApm::Environment.instance.app_server, :ruby_version => RUBY_VERSION, :hostname => ScoutApm::Environment.instance.hostname, :database_engine => ScoutApm::Environment.instance.database_engine, :application_name => ScoutApm::Environment.instance.application_name, :libraries => ScoutApm::Utils::InstalledGems.new.run, :paas => ScoutApm::Environment.instance.platform_integration.name } end |
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/scout_apm/app_server_load.rb', line 9 def run @thread = Thread.new do begin logger.info "Sending Application Startup Info - App Server: #{data[:app_server]}, Framework: #{data[:framework]}, Framework Version: #{data[:framework_version]}, Database Engine: #{data[:database_engine]}" logger.debug("Full Application Startup Info: #{data.inspect}") payload = ScoutApm::Serializers::AppServerLoadSerializer.serialize(data) reporter = Reporter.new(:app_server_load) reporter.report(payload) logger.debug("Finished sending Startup Info") rescue => e logger.info("Failed Sending Application Startup Info - #{e.}") logger.debug(e.backtrace.join("\t\n")) end end rescue => e logger.debug("Failed Startup Info - #{e.} \n\t#{e.backtrace.join("\t\n")}") end |