Class: AppMap::Handler::Rails::RequestHandler::RackHook
- Inherits:
-
AppMap::Hook::Method
- Object
- AppMap::Hook::Method
- AppMap::Handler::Rails::RequestHandler::RackHook
- Defined in:
- lib/appmap/handler/rails/request_handler.rb
Overview
Additional hook for the Rack stack in Rails applications.
Hooking just in ActionController can be inaccurate if there’s a middleware that intercepts the response and modifies it, or catches an exception or an object and does some other processing. For example, Devise catches a throw from warden on authentication error, then runs ActionController stack AGAIN to render a login page, which it then modifies to change the HTTP status code. ActionDispatch::Executor seems a good place to hook as the central entry point in a Rails application; there are a couple middleware that sometimes sit on top of it but they’re usually inconsequential. One issue is that the executor can be entered several times in the stack (especially if Rails engines are used). To handle that, we set a context in the request environment the first time we enter it.
Constant Summary
Constants inherited from AppMap::Hook::Method
AppMap::Hook::Method::HOOK_DISABLE_KEY
Constants included from AppMap::Hook::RecordAround
AppMap::Hook::RecordAround::APPMAP_OUTPUT_DIR
Instance Attribute Summary
Attributes inherited from AppMap::Hook::Method
#arity, #hook_class, #hook_method, #hook_package, #parameters, #record_around
Instance Method Summary collapse
-
#initialize ⇒ RackHook
constructor
A new instance of RackHook.
Methods inherited from AppMap::Hook::Method
Methods included from AppMap::Hook::RecordAround
#record_around?, #record_around_after, #record_around_before
Constructor Details
#initialize ⇒ RackHook
Returns a new instance of RackHook.
154 155 156 |
# File 'lib/appmap/handler/rails/request_handler.rb', line 154 def initialize super(nil, ActionDispatch::Executor, ActionDispatch::Executor.instance_method(:call)) end |