module Stats

Public Class Methods

client() click to toggle source
# File lib/mas/stats.rb, line 14
def self.client
  $statsd ||= Statsd.new('statsd.hostedgraphite.com', 8125).tap do |n|
    n.namespace = key
  end
end
gauge(*args) click to toggle source
# File lib/mas/stats.rb, line 6
def self.gauge(*args)
  client.gauge(*args) if key
end
increment(*args) click to toggle source
# File lib/mas/stats.rb, line 2
def self.increment(*args)
  client.increment(*args) if key
end
key() click to toggle source
# File lib/mas/stats.rb, line 20
def self.key
  ENV['HOSTEDGRAPHITE_APIKEY']
end
time(*args, &block) click to toggle source
# File lib/mas/stats.rb, line 10
def self.time(*args, &block)
  key ? client.time(*args, &block) : block.call
end