lib/statsd/statsd.rb
# A namespace to prepend to all statsd calls.
A namespace to prepend to all statsd calls.
A namespace to prepend to all statsd calls .
def send_stats(stat, delta, type, sample_rate=1)
      if sample_rate == 1 or rand < sample_rate
        stat = stat.to_s.gsub('::', '.').tr(':|@', '_')
        rate = "|@#{sample_rate}" unless sample_rate == 1
        send_to_socket "#{@prefix}#{stat}:#{delta}|#{type}#{rate}"
      end
    end
def send_stats ( stat , delta , type , sample_rate = 1 ) if sample_rate == 1 or rand < sample_rate stat = stat . to_s . gsub ( '::' , '.' ) . tr ( ':|@' , '_' ) rate = "|@#{sample_rate}" unless sample_rate == 1 send_to_socket "#{@prefix}#{stat}:#{delta}|#{type}#{rate}" end end
A namespace to prepend to all statsd calls.
A namespace to prepend to all statsd calls .
# Replace Ruby module scoping with '.' and reserved chars (: | @) with underscores.
stat
delta
type
sample_rate