In Files

Parent

Statsd::Client

Statsd::Client by Ben VandenBos github.com/bvandenbos/statsd-client

Constants

Version

Attributes

host[RW]
port[RW]

Public Class Methods

new(host='localhost', port=8125) click to toggle source
# File lib/statsd.rb, line 12
def initialize(host='localhost', port=8125)
  @host = host
  @port = port
end

Public Instance Methods

decrement(stats, sample_rate = 1) click to toggle source

stats can be a string or an array of strings

# File lib/statsd.rb, line 29
def decrement(stats, sample_rate = 1)
  update_counter stats, -1, sample_rate
end
increment(stats, sample_rate = 1) click to toggle source

stats can be a string or an array of strings

# File lib/statsd.rb, line 24
def increment(stats, sample_rate = 1)
  update_counter stats, 1, sample_rate
end
timing(stat, time, sample_rate = 1) click to toggle source

stat to log timing for time is the time to log in ms

# File lib/statsd.rb, line 19
def timing(stat, time, sample_rate = 1)
  send_stats "#{stat}:#{time}|ms", sample_rate
end
update_counter(stats, delta = 1, sample_rate = 1) click to toggle source

stats can be a string or array of strings

# File lib/statsd.rb, line 34
def update_counter(stats, delta = 1, sample_rate = 1)
  stats = Array(stats)
  send_stats(stats.map { |s| "#{s}:#{delta}|c" }, sample_rate)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.