Class: Deimos::Metrics::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/deimos/metrics/mock.rb

Overview

A mock Metrics wrapper which just logs the metrics

Instance Method Summary collapse

Constructor Details

#initialize(logger = nil) ⇒ Mock

:nodoc:



10
11
12
13
# File 'lib/deimos/metrics/mock.rb', line 10

def initialize(logger=nil)
  @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, options={})
  @logger.info("MockMetricsProvider.gauge: #{metric_name}, #{count}, #{options}")
end

#histogram(metric_name, count, options = {}) ⇒ Object

:nodoc:



26
27
28
# File 'lib/deimos/metrics/mock.rb', line 26

def histogram(metric_name, count, options={})
  @logger.info("MockMetricsProvider.histogram: #{metric_name}, #{count}, #{options}")
end

#increment(metric_name, options = {}) ⇒ Object

:nodoc:



16
17
18
# File 'lib/deimos/metrics/mock.rb', line 16

def increment(metric_name, options={})
  @logger.info("MockMetricsProvider.increment: #{metric_name}, #{options}")
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, options={})
  start_time = Time.now
  yield
  total_time = (Time.now - start_time).to_i
  @logger.info("MockMetricsProvider.time: #{metric_name}, #{total_time}, #{options}")
end