Class: LHC::Monitoring
- Inherits:
-
Interceptor
- Object
- Interceptor
- LHC::Monitoring
- Includes:
- ActiveSupport::Configurable
- Defined in:
- lib/lhc/interceptors/monitoring.rb
Constant Summary collapse
- FORWARDED_OPTIONS =
Options forwarded to the monitoring
{ monitoring_key: :key }
Instance Attribute Summary
Attributes inherited from Interceptor
Instance Method Summary collapse
Methods inherited from Interceptor
#before_raw_request, #before_response, dup, #initialize, #response
Constructor Details
This class inherits a constructor from LHC::Interceptor
Instance Method Details
#after_request ⇒ Object
19 20 21 22 23 |
# File 'lib/lhc/interceptors/monitoring.rb', line 19 def after_request return unless statsd LHC::Monitoring.statsd.count("#{key(request)}.count", 1) LHC::Monitoring.statsd.count("#{key(request)}.after_request", 1) end |
#after_response ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/lhc/interceptors/monitoring.rb', line 25 def after_response return unless statsd key = key(response) LHC::Monitoring.statsd.timing("#{key}.time", response.time) if response.success? key += response.timeout? ? '.timeout' : ".#{response.code}" LHC::Monitoring.statsd.count(key, 1) end |
#before_request ⇒ Object
14 15 16 17 |
# File 'lib/lhc/interceptors/monitoring.rb', line 14 def before_request return unless statsd LHC::Monitoring.statsd.count("#{key(request)}.before_request", 1) end |