Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed May 25, 2011
1 parent 5cb528a commit 4731f89
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.rst
Expand Up @@ -30,9 +30,9 @@ Timers
^^^^^^

>>> import statsd

>>>
>>> timer = statsd.Timer('MyApplication')

>>>
>>> timer.start()
>>> # do something here
>>> timer.stop('SomeTimer')
Expand All @@ -42,7 +42,7 @@ Counters
^^^^^^^^

>>> import statsd

>>>
>>> counter = statsd.Counter('MyApplication')
>>> # do something here
>>> counter += 1
Expand All @@ -53,33 +53,33 @@ Advanced Usage
--------------

>>> import statsd

>>>
>>> # Open a connection to `server` on port `1234` with a `50%` sample rate
>>> statsd_connection = statsd.Connection(
... name='server',
... port=1234,
... sample_rate=0.5,
... )

>>>
>>> # Create a client for this application
>>> statsd_client = statsd.Client(__name__, statsd_connection)

>>>
>>> class SomeClass(object):
... def __init__(self):
... # Create a client specific for this class
... self.statsd_client = statsd_client.get_client(
... self.__class__.__name__)

...
... def do_something(self):
... # Create a `timer` client
... timer = self.statsd_client.get_client(class_=statsd.Timer)

...
... # start the measurement
... timer.start()

...
... # do something
... timer.interval('intermediate_value')

...
... # do something else
... timer.stop('total')

0 comments on commit 4731f89

Please sign in to comment.