123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::MiddlewareStack::InstrumentationProxy

Relationships & Source Files
Inherits: Object
Defined in: actionpack/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

Class Method Summary

Instance Method Summary

Constructor Details

.new(middleware, class_name) ⇒ InstrumentationProxy

[ GitHub ]

  
# File 'actionpack/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)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/middleware/stack.rb', line 65

def call(env)
  ActiveSupport::Notifications.instrument(EVENT_NAME, @payload) do
    @middleware.call(env)
  end
end