module Taskinator::LogStats

Public Class Methods

client() click to toggle source
# File lib/taskinator/log_stats.rb, line 11
def client
  defined?(@client) ? @client : initialize_client
end
client=(statsd_client) click to toggle source
# File lib/taskinator/log_stats.rb, line 15
def client=(statsd_client)
  @client = (statsd_client ? statsd_client : initialize_client)
end
count(stat, count) click to toggle source
# File lib/taskinator/log_stats.rb, line 36
def count(stat, count)
  client.count(stat, count)
end
decrement(stat) click to toggle source
# File lib/taskinator/log_stats.rb, line 44
def decrement(stat)
  client.decrement(stat)
end
duration(stat, duration) click to toggle source
# File lib/taskinator/log_stats.rb, line 19
def duration(stat, duration)
  client.timing(stat, duration * 1000)
end
gauge(stat, count) click to toggle source
# File lib/taskinator/log_stats.rb, line 32
def gauge(stat, count)
  client.gauge(stat, count)
end
increment(stat) click to toggle source
# File lib/taskinator/log_stats.rb, line 40
def increment(stat)
  client.increment(stat)
end
initialize_client() click to toggle source
# File lib/taskinator/log_stats.rb, line 7
def initialize_client
  @client = Statsd.new()
end
timing(stat) { || ... } click to toggle source
# File lib/taskinator/log_stats.rb, line 23
def timing(stat, &block)
  result = nil
  duration = Benchmark.realtime do
    result = yield
  end
  duration(stat, duration)
  result
end