Class: ActionDispatch::MiddlewareStack::InstrumentationProxy
- Inherits:
-
Object
- Object
- ActionDispatch::MiddlewareStack::InstrumentationProxy
- Defined in:
- lib/action_dispatch/middleware/stack.rb
Overview
This class is used to instrument the execution of a single middleware. It proxies the ‘call` method transparently and instruments the method call.
Constant Summary collapse
- EVENT_NAME =
"process_middleware.action_dispatch"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(middleware, class_name) ⇒ InstrumentationProxy
constructor
A new instance of InstrumentationProxy.
Constructor Details
#initialize(middleware, class_name) ⇒ InstrumentationProxy
Returns a new instance of InstrumentationProxy.
57 58 59 60 61 62 63 |
# File 'lib/action_dispatch/middleware/stack.rb', line 57 def initialize(middleware, class_name) @middleware = middleware @payload = { middleware: class_name, } end |
Instance Method Details
#call(env) ⇒ Object
65 66 67 68 69 |
# File 'lib/action_dispatch/middleware/stack.rb', line 65 def call(env) ActiveSupport::Notifications.instrument(EVENT_NAME, @payload) do @middleware.call(env) end end |