Class: Contrast::Agent::Reporting::ApplicationInventory
- Inherits:
-
ApplicationReportingEvent
- Object
- ReportableHash
- ReportingEvent
- ApplicationReportingEvent
- Contrast::Agent::Reporting::ApplicationInventory
- Defined in:
- lib/contrast/agent/reporting/reporting_events/application_inventory.rb
Overview
This is the new ApplicationInventory class which will include all the needed information for the new reporting system to report. Reporting those components or details discovered at startup, or as soon as possible, but not necessarily seen used by the application. Each of these messages should only be sent once per application.
Instance Attribute Summary collapse
- #routes ⇒ Object readonly
Attributes inherited from ReportingEvent
#event_endpoint, #event_method
Instance Method Summary collapse
- #file_name ⇒ Object
-
#initialize ⇒ ApplicationInventory
constructor
A new instance of ApplicationInventory.
- #to_controlled_hash ⇒ Object
Methods inherited from ReportingEvent
Methods inherited from ReportableHash
#event_json, #valid?, #validate
Methods included from Components::Logger::InstanceMethods
Constructor Details
#initialize ⇒ ApplicationInventory
Returns a new instance of ApplicationInventory.
20 21 22 23 24 25 26 27 |
# File 'lib/contrast/agent/reporting/reporting_events/application_inventory.rb', line 20 def initialize @event_type = :application_inventory @event_method = :POST @event_endpoint = Contrast::Agent::Reporting::Endpoints.application_inventory # The API spec limits us to 500 routes, so we'll enforce that here to not hold on to superfulous data. @routes = Contrast::Agent.framework_manager.find_route_discovery_data&.take(500) super() end |
Instance Attribute Details
#routes ⇒ Object (readonly)
18 19 20 |
# File 'lib/contrast/agent/reporting/reporting_events/application_inventory.rb', line 18 def routes @routes end |
Instance Method Details
#file_name ⇒ Object
29 30 31 |
# File 'lib/contrast/agent/reporting/reporting_events/application_inventory.rb', line 29 def file_name 'applications-inventory' end |
#to_controlled_hash ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/contrast/agent/reporting/reporting_events/application_inventory.rb', line 33 def to_controlled_hash { session_id: ::Contrast::ASSESS.session_id, # documentation lists routes as deprecated from the agent_ng_endpoints.yml routes: routes.map(&:to_controlled_hash) } end |