Class: Contrast::Agent::Reporting::ApplicationStartup

Inherits:
ApplicationReportingEvent show all
Defined in:
lib/contrast/agent/reporting/reporting_events/application_startup.rb

Overview

This is the new ApplicationStartup class which will include all the needed information for the new reporting system to report an Application has started; creating a new one or marking an existing one as online in the Contrast UI

Instance Attribute Summary

Attributes inherited from ReportingEvent

#event_endpoint, #event_method

Instance Method Summary collapse

Methods inherited from ReportingEvent

#attach_headers

Methods inherited from ReportableHash

#event_json, #valid?, #validate

Methods included from Components::Logger::InstanceMethods

#cef_logger, #logger

Constructor Details

#initializeApplicationStartup

Returns a new instance of ApplicationStartup.



15
16
17
18
19
# File 'lib/contrast/agent/reporting/reporting_events/application_startup.rb', line 15

def initialize
  @event_method = :PUT
  @event_endpoint = Contrast::Agent::Reporting::Endpoints::NG_ENDPOINTS[:application_create]
  super()
end

Instance Method Details

#file_nameObject



21
22
23
# File 'lib/contrast/agent/reporting/reporting_events/application_startup.rb', line 21

def file_name
  'applications-create'
end

#to_controlled_hashHash

Convert the instance variables on the class, and other information, into the identifiers required for TeamServer to process the JSON form of this message.

Returns:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/contrast/agent/reporting/reporting_events/application_startup.rb', line 29

def to_controlled_hash
  app_config = ::Contrast::CONFIG.application
  {
      code: app_config.code,
      group: app_config.group,
      instrumentation: Contrast::Agent::Reporting::ApplicationStartupInstrumentation.new.to_controlled_hash,
      metadata: app_config.,
      session_id: ::Contrast::CONFIG.session_id,
      session_metadata: ::Contrast::CONFIG.,
      tags: app_config.tags
  }.compact
end