Module: Datadog::AppSec::Contrib::Rails::Patcher::ProcessActionPatch

Defined in:
lib/datadog/appsec/contrib/rails/patcher.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#process_action(*args) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/datadog/appsec/contrib/rails/patcher.rb', line 70

def process_action(*args)
  env = request.env

  context = 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