Class: Librato::Metrics::Middleware::CountRequests

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/librato/metrics/middleware/count_requests.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.total_requestsObject (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

.incrementObject



11
12
13
# File 'lib/librato/metrics/middleware/count_requests.rb', line 11

def increment
  @total_requests += 1
end

.resetObject



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