Class: Rack::Instrumentation
- Inherits:
-
Object
- Object
- Rack::Instrumentation
- Includes:
- Metrics::MiddlewareHelpers
- Defined in:
- lib/rack/instrumentation.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Instrumentation
constructor
A new instance of Instrumentation.
Constructor Details
#initialize(app) ⇒ Instrumentation
Returns a new instance of Instrumentation.
7 8 9 |
# File 'lib/rack/instrumentation.rb', line 7 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rack/instrumentation.rb', line 11 def call(env) begin header_metrics env time = Time.now response = @app.call(env) duration = (Time.now - time) * 1000.0 request_metrics response.first, duration, metric: 'rack.request' response rescue Exception => raised instrument 'rack.exception', 1, type: 'count' raise end end |