Class: Metrician::Reporters::Middleware
- Inherits:
-
Metrician::Reporter
- Object
- Metrician::Reporter
- Metrician::Reporters::Middleware
- Defined in:
- lib/metrician/reporters/middleware.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Metrician::Reporter
Class Method Details
.enabled? ⇒ Boolean
4 5 6 7 |
# File 'lib/metrician/reporters/middleware.rb', line 4 def self.enabled? defined?(Rails) && Metrician::Middleware.enabled? end |
Instance Method Details
#instrument ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/metrician/reporters/middleware.rb', line 9 def instrument require "metrician/middleware/request_timing" require "metrician/middleware/application_timing" app = Rails.application return if app.nil? app.middleware.insert_before(0, Metrician::Middleware::RequestTiming) app.middleware.insert_after(Metrician::Middleware::RequestTiming, Rack::ContentLength) app.middleware.use(Metrician::Middleware::ApplicationTiming) end |