Class: RailsMetrics::Middleware
- Inherits:
-
Object
- Object
- RailsMetrics::Middleware
- Defined in:
- lib/rails_metrics/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
3 4 5 |
# File 'lib/rails_metrics/middleware.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rails_metrics/middleware.rb', line 7 def call(env) if env["PATH_INFO"] =~ /^\/rails_metrics/ @app.call(env) else RailsMetrics.listen_request do response = notifications.instrument "rack.request", :path => env["PATH_INFO"], :method => env["REQUEST_METHOD"], :instrumenter_id => notifications.instrumenter.id do @app.call(env) end end end end |