Class: ScoutApm::Reporter
- Inherits:
-
Object
- Object
- ScoutApm::Reporter
- Defined in:
- lib/scout_apm/reporter.rb
Constant Summary collapse
- CA_FILE =
File.join( File.dirname(__FILE__), *%w[.. .. data cacert.pem] )
- VERIFY_MODE =
OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type = :checkin, config = Agent.instance.config, logger = Agent.instance.logger) ⇒ Reporter
constructor
A new instance of Reporter.
-
#report(payload) ⇒ Object
TODO: Parse & return a real response object, not the HTTP Response object.
- #uri ⇒ Object
Constructor Details
#initialize(type = :checkin, config = Agent.instance.config, logger = Agent.instance.logger) ⇒ Reporter
Returns a new instance of Reporter.
12 13 14 15 16 |
# File 'lib/scout_apm/reporter.rb', line 12 def initialize(type = :checkin, config=Agent.instance.config, logger=Agent.instance.logger) @config = config @logger = logger @type = type end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/scout_apm/reporter.rb', line 8 def config @config end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
9 10 11 |
# File 'lib/scout_apm/reporter.rb', line 9 def logger @logger end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/scout_apm/reporter.rb', line 10 def type @type end |
Instance Method Details
#report(payload) ⇒ Object
TODO: Parse & return a real response object, not the HTTP Response object
19 20 21 |
# File 'lib/scout_apm/reporter.rb', line 19 def report(payload) post(uri, payload) end |
#uri ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/scout_apm/reporter.rb', line 23 def uri case type when :checkin URI.parse("#{config.value('host')}/apps/checkin.scout?key=#{config.value('key')}&name=#{CGI.escape(Environment.instance.application_name)}") when :app_server_load URI.parse("#{config.value('host')}/apps/app_server_load.scout?key=#{config.value('key')}&name=#{CGI.escape(Environment.instance.application_name)}") end.tap{|u| logger.debug("Posting to #{u.to_s}")} end |