Class: Sneakers::Metrics::StatsdMetrics
- Inherits:
-
Object
- Object
- Sneakers::Metrics::StatsdMetrics
- Defined in:
- lib/sneakers/metrics/statsd_metrics.rb
Instance Method Summary collapse
- #increment(metric) ⇒ Object
-
#initialize(conn) ⇒ StatsdMetrics
constructor
A new instance of StatsdMetrics.
- #timing(metric, &block) ⇒ Object
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 |