Skip to content

Commit

Permalink
Implement Statsd#timing
Browse files Browse the repository at this point in the history
  • Loading branch information
Rein Henrichs committed Feb 19, 2011
1 parent 9700de4 commit 8ef437e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/statsd.rb
Expand Up @@ -16,6 +16,10 @@ def count(stat, count)
socket.send("#{stat}:#{count}|c")
end

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

private

def socket
Expand Down
7 changes: 7 additions & 0 deletions spec/statsd_spec.rb
Expand Up @@ -31,4 +31,11 @@ def socket
end
end

describe "#timing" do
it "should format the message according to the statsd spec" do
@statsd.timing('foobar', 500)
@statsd.socket.recv.must_equal ['foobar:500|ms']
end
end

end

0 comments on commit 8ef437e

Please sign in to comment.