Module: Contrast::Extension::Assess::ExecTrigger

Included in:
KernelPropagator
Defined in:
lib/contrast/extension/assess/exec_trigger.rb

Overview

This Module allows us to track calls to the Kernel#exec method, which violates the design of most methods we track in that we have to apply the trigger at the start in order to account for the process hand off.

Instance Method Summary collapse

Instance Method Details

#apply_trigger(source) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/contrast/extension/assess/exec_trigger.rb', line 13

def apply_trigger source
  return unless ::Contrast::ASSESS.non_request_tracking? || Contrast::Agent::REQUEST_TRACKER.current
  # Since we know this is the source of the trigger, we can do some
  # optimization here and return when it is not tracked
  return unless Contrast::Utils::Assess::TrackingUtil.tracked?(source)

  # source might not be all the args passed in, but it is the one we care
  # about. we could pass in all the args in the last param here if it
  # becomes an issue in rendering on TS
  finding = Contrast::Agent::Assess::Policy::TriggerMethod.build_finding(trigger_node,
                                                                         source, Kernel, nil, source)
  Contrast::Agent::Assess::Policy::TriggerMethod.report_finding(finding) if finding
end