Class: Sneakers::Metrics::StatsdMetrics

Inherits:
Object
  • Object
show all
Defined in:
lib/sneakers/metrics/statsd_metrics.rb

Instance Method Summary collapse

Constructor Details

#initialize(conn) ⇒ StatsdMetrics

Returns a new instance of StatsdMetrics.



4
5
6
# File 'lib/sneakers/metrics/statsd_metrics.rb', line 4

def initialize(conn)
  @connection = conn
end

Instance Method Details

#increment(metric) ⇒ Object



8
9
10
# File 'lib/sneakers/metrics/statsd_metrics.rb', line 8

def increment(metric)
  @connection.increment(metric)
end

#timing(metric, &block) ⇒ Object



12
13
14
15
16
# File 'lib/sneakers/metrics/statsd_metrics.rb', line 12

def timing(metric, &block)
  start = Time.now
  block.call
  @connection.timing(metric, ((Time.now - start)*1000).floor)
end