Permalink
Browse files

Implement Statsd#timing

  • Loading branch information...
1 parent 9700de4 commit 8ef437e235567cc43e0cf712304a364cd5b7a1eb Rein Henrichs committed Feb 19, 2011
Showing with 11 additions and 0 deletions.
  1. +4 −0 lib/statsd.rb
  2. +7 −0 spec/statsd_spec.rb
View
@@ -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
View
@@ -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.