Module: TCellAgent::AppSensor::InjectionsReporter

Defined in:
lib/tcell_agent/appsensor/injections_reporter.rb

Class Method Summary collapse

Class Method Details

.report_and_log(events) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tcell_agent/appsensor/injections_reporter.rb', line 8

def self.report_and_log(events)
  (events || []).each do |event|
    TCellAgent.send_event(
      TCellAgent::SensorEvents::TCellAppSensorEvent.build_from_native_lib_event(event)
    )

    if event.has_key?("full_payload")
      event_to_log = {}.merge(event)
      event_to_log["payload"] = event_to_log.delete("full_payload")

      cleaned_event = TCellAgent::SensorEvents::TCellAppSensorEvent.build_from_native_lib_event(
        event_to_log
      )
      TCellAgent.logger.info(JSON.dump(cleaned_event))
    end
  end
end