Skip to main content

A simple statsd client.

Project description

statsd is a friendly front-end to Graphite. This is a Python client for the statsd daemon.

To use:

>>> import statsd
>>> c = statsd.StatsClient('localhost', 8125)
>>> c.incr('foo')  # Increment the 'foo' counter.
>>> c.timing('stats.timed', 320)  # Record a 320ms 'stats.timed'.

In Django

If you’re lucky enough to be using statsd in Django, you can configure a default client in your settings module with two values. The defaults are:

STATSD_HOST = 'localhost'
STATSD_PORT = 8125

Then instead of instantiating a new client every time, you can just grab:

>>> from statsd import statsd
>>> statsd.incr('foo')

Context Manager

You can use a StatsClient instance as a context manager to easily time sections of code with the timer() method:

>>> from statsd import statsd
>>> with statsd.timer('bar'):
...     func()
...     func()

When the managed block exits, the client will automatically send the time it took to statsd.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

statsd-0.1.1.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file statsd-0.1.1.tar.gz.

File metadata

  • Download URL: statsd-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for statsd-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a4670a5237c4fc86b74bc2035403629188d8dc50adb850edfa3cf407bb0b21bb
MD5 a9c031c3045d658f1d6bef94aa2dca40
BLAKE2b-256 14f77d19ab9e5a17a364ad0cfe01feee369fe1d6f111e4fba820c9f92aaf688f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page