class StatsdHelper

Public Class Methods

graphite_host() click to toggle source
# File lib/resque-statsd.rb, line 6
def self.graphite_host
  return @graphite_host || ENV['GRAPHITE_HOST'] || 'localhost'
end
graphite_host=(val) click to toggle source
# File lib/resque-statsd.rb, line 9
def self.graphite_host=(val)
  @graphite_host = val
end
graphite_port() click to toggle source
# File lib/resque-statsd.rb, line 13
def self.graphite_port
  return @graphite_port || ENV['GRAPHITE_PORT'] || 8125
end
graphite_port=(val) click to toggle source
# File lib/resque-statsd.rb, line 16
def self.graphite_port=(val)
  @graphite_port = val
end
namespace() click to toggle source
# File lib/resque-statsd.rb, line 20
def self.namespace
  return @namespace || ENV['GRAPHITE_NAMESPACE'] || 'resque'
end
namespace=(val) click to toggle source
# File lib/resque-statsd.rb, line 23
def self.namespace=(val)
  @namespace = val
end
statsd() click to toggle source

Set up the client lazily, to minimize order-of-operations headaches.

# File lib/resque-statsd.rb, line 28
def self.statsd
  if(@stats.nil?)
    @statsd = Statsd.new(graphite_host, graphite_port)
    @statsd.namespace = namespace
  end
  return @statsd
end