Permalink
Browse files

Add basic usage to docs

  • Loading branch information...
1 parent d99be81 commit d7d53bb176e787e1e930ad5fa46887382837cc46 @oscardelben oscardelben committed Sep 25, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 README.rdoc
View
@@ -7,6 +7,23 @@ A Ruby client for {StatsD}[https://github.com/etsy/statsd]
Bundler:
gem "statsd-ruby", :require => "statsd"
+= Basic Usage
+
+ # Set up a global Statsd client for a server on localhost:9125
+ $statsd = Statsd.new 'localhost', 8125
+
+ # Send some stats
+ $statsd.increment 'garets'
+ $statsd.timing 'glork', 320
+ $statsd.gauge 'bork', 100
+
+ # Use {#time} to time the execution of a block
+ $statsd.time('account.activate') { @account.activate! }
+
+ # Create a namespaced statsd client and increment 'account.activate'
+ statsd = Statsd.new('localhost').tap{|sd| sd.namespace = 'account'}
+ statsd.increment 'activate'
+
= Testing
Run the specs with <tt>rake spec</tt>

0 comments on commit d7d53bb

Please sign in to comment.