Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add basic usage #23

Merged
merged 1 commit into from

2 participants

Oscar Del Ben Rein Henrichs
Oscar Del Ben

Some basic usage on the Readme.

Rein Henrichs
Owner

:thumbsup: thanks!

Rein Henrichs reinh merged commit 93cda05 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 25, 2012
  1. Oscar Del Ben

    Add basic usage to docs

    oscardelben authored
This page is out of date. Refresh to see the latest.
Showing with 17 additions and 0 deletions.
  1. +17 −0 README.rdoc
17 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>
Something went wrong with that request. Please try again.