Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add basic usage #23

Merged
merged 1 commit into from

2 participants

@oscardelben

Some basic usage on the Readme.

@reinh
Owner

:thumbsup: thanks!

@reinh reinh merged commit 93cda05 into reinh:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 25, 2012
  1. @oscardelben

    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
View
17 README.rdoc
@@ -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.