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



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

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

    next unless event.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