Module: Datadog::AppSec::Contrib::Rails::Patches::ProcessActionPatch

Defined in:
lib/datadog/appsec/contrib/rails/patches/process_action_patch.rb

Overview

Hook into ActionController::Instrumentation#process_action, which encompasses action filters

Instance Method Summary collapse

Instance Method Details

#process_action(*args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/datadog/appsec/contrib/rails/patches/process_action_patch.rb', line 10

def process_action(*args)
  context = request.env[Datadog::AppSec::Ext::CONTEXT_KEY]
  return super unless context

  # TODO: handle exceptions, except for super
  gateway_request = Gateway::Request.new(request)
  http_response, _gateway_request = Instrumentation.gateway.push('rails.request.action', gateway_request) do
    super
  end

  http_response
end