Skip to content

Commit

Permalink
Refactor Statsd#timing and #count to use #send
Browse files Browse the repository at this point in the history
  • Loading branch information
Rein Henrichs committed Feb 19, 2011
1 parent 8ef437e commit a480d98
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/statsd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ def decrement(stat)
end

def count(stat, count)
socket.send("#{stat}:#{count}|c")
send(stat, count, 'c')
end

def timing(stat, ms)
socket.send("#{stat}:#{ms}|ms")
send(stat, ms, 'ms')
end

private

def send(stat, delta, type)
socket.send("#{stat}:#{delta}|#{type}")
end

def socket
@socket ||= UDPSocket.new(host, post)
end
Expand Down

0 comments on commit a480d98

Please sign in to comment.