Class: Librato::Metrics::Middleware::CountRequests
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Librato::Metrics::Middleware::CountRequests
- Defined in:
- lib/librato/metrics/middleware/count_requests.rb
Class Attribute Summary collapse
-
.total_requests ⇒ Object
readonly
Returns the value of attribute total_requests.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.total_requests ⇒ Object (readonly)
Returns the value of attribute total_requests.
9 10 11 |
# File 'lib/librato/metrics/middleware/count_requests.rb', line 9 def total_requests @total_requests end |
Class Method Details
.increment ⇒ Object
11 12 13 |
# File 'lib/librato/metrics/middleware/count_requests.rb', line 11 def increment @total_requests += 1 end |
.reset ⇒ Object
15 16 17 |
# File 'lib/librato/metrics/middleware/count_requests.rb', line 15 def reset @total_requests = 0 end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 |
# File 'lib/librato/metrics/middleware/count_requests.rb', line 20 def call(env) self.class.increment @app.call(env) end |