Class: DHC::Monitoring

Inherits:
Interceptor show all
Includes:
ActiveSupport::Configurable
Defined in:
lib/dhc/interceptors/monitoring.rb

Constant Summary collapse

FORWARDED_OPTIONS =

Options forwarded to the monitoring

{
  monitoring_key: :key
}.freeze

Instance Attribute Summary

Attributes inherited from Interceptor

#request

Instance Method Summary collapse

Methods inherited from Interceptor

#all_interceptor_classes, #before_init, #before_response, dup, #initialize, #response

Constructor Details

This class inherits a constructor from DHC::Interceptor

Instance Method Details

#after_requestObject



19
20
21
22
23
# File 'lib/dhc/interceptors/monitoring.rb', line 19

def after_request
  return unless statsd
  DHC::Monitoring.statsd.count("#{key}.count", 1)
  DHC::Monitoring.statsd.count("#{key}.after_request", 1)
end

#after_responseObject



25
26
27
28
29
30
# File 'lib/dhc/interceptors/monitoring.rb', line 25

def after_response
  return unless statsd
  monitor_time!
  monitor_cache!
  monitor_response!
end

#before_requestObject



14
15
16
17
# File 'lib/dhc/interceptors/monitoring.rb', line 14

def before_request
  return unless statsd
  DHC::Monitoring.statsd.count("#{key}.before_request", 1)
end