Class: LHC::Monitoring

Inherits:
Interceptor show all
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

#request

Instance Method Summary collapse

Methods inherited from Interceptor

#all_interceptor_classes, #before_raw_request, #before_response, dup, #initialize, #response

Constructor Details

This class inherits a constructor from LHC::Interceptor

Instance Method Details

#after_requestObject



20
21
22
23
24
25
# File 'lib/lhc/interceptors/monitoring.rb', line 20

def after_request
  return unless statsd

  LHC::Monitoring.statsd.count("#{key}.count", 1)
  LHC::Monitoring.statsd.count("#{key}.after_request", 1)
end

#after_responseObject



27
28
29
30
31
32
33
# File 'lib/lhc/interceptors/monitoring.rb', line 27

def after_response
  return unless statsd

  monitor_time!
  monitor_cache!
  monitor_response!
end

#before_requestObject



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

def before_request
  return unless statsd

  LHC::Monitoring.statsd.count("#{key}.before_request", 1)
end