Class: Deimos::Metrics::Mock
- Defined in:
- lib/deimos/metrics/mock.rb
Overview
A mock Metrics wrapper which just logs the metrics
Instance Method Summary collapse
-
#gauge(metric_name, count, options = {}) ⇒ Object
:nodoc:.
-
#histogram(metric_name, count, options = {}) ⇒ Object
:nodoc:.
-
#increment(metric_name, options = {}) ⇒ Object
:nodoc:.
-
#initialize(logger = nil) ⇒ Mock
constructor
A new instance of Mock.
-
#time(metric_name, options = {}) ⇒ Object
:nodoc:.
Constructor Details
#initialize(logger = nil) ⇒ Mock
Returns a new instance of Mock.
10 11 12 13 |
# File 'lib/deimos/metrics/mock.rb', line 10 def initialize(logger=nil) # rubocop:disable Lint/MissingSuper @logger = logger || Logger.new(STDOUT) @logger.info('MockMetricsProvider initialized') end |
Instance Method Details
#gauge(metric_name, count, options = {}) ⇒ Object
:nodoc:
21 22 23 |
# File 'lib/deimos/metrics/mock.rb', line 21 def gauge(metric_name, count, ={}) @logger.info("MockMetricsProvider.gauge: #{metric_name}, #{count}, #{}") end |
#histogram(metric_name, count, options = {}) ⇒ Object
:nodoc:
26 27 28 |
# File 'lib/deimos/metrics/mock.rb', line 26 def histogram(metric_name, count, ={}) @logger.info("MockMetricsProvider.histogram: #{metric_name}, #{count}, #{}") end |
#increment(metric_name, options = {}) ⇒ Object
:nodoc:
16 17 18 |
# File 'lib/deimos/metrics/mock.rb', line 16 def increment(metric_name, ={}) @logger.info("MockMetricsProvider.increment: #{metric_name}, #{}") end |
#time(metric_name, options = {}) ⇒ Object
:nodoc:
31 32 33 34 35 36 |
# File 'lib/deimos/metrics/mock.rb', line 31 def time(metric_name, ={}) start_time = Time.now yield total_time = (Time.now - start_time).to_i @logger.info("MockMetricsProvider.time: #{metric_name}, #{total_time}, #{}") end |