Class: Roundtrip::Metrics::Statsd

Inherits:
Object
  • Object
show all
Defined in:
lib/roundtrip/metrics/statsd.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {:statsd => {:host => 'localhost', :port => 8125}}) ⇒ Statsd

Returns a new instance of Statsd.



5
6
7
# File 'lib/roundtrip/metrics/statsd.rb', line 5

def initialize(opts={:statsd => {:host => 'localhost', :port => 8125}})
  @statsd =opts[:statsd][:connection] || ::Statsd.new(opts[:statsd][:host], opts[:statsd][:port])
end

Instance Method Details

#time(route, event, time) ⇒ Object



9
10
11
# File 'lib/roundtrip/metrics/statsd.rb', line 9

def time(route, event, time)
  @statsd.timing("#{route}.#{event}", time)
end