Class: Authify::API::Middleware::Metrics
- Inherits:
-
Object
- Object
- Authify::API::Middleware::Metrics
- Defined in:
- lib/authify/api/middleware/metrics.rb
Overview
A middleware for analytics of rack requests
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Metrics
constructor
A new instance of Metrics.
Constructor Details
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/authify/api/middleware/metrics.rb', line 12 def call(env) status, header, body = @metrics.time(construct_metric_key('time', env)) do @app.call env end @metrics.increment construct_metric_key('count', env) @metrics.increment 'rack.request.count' [status, header, body] end |