Skip to main content

A simple statsd client.

Project description

A Python statsd client

A python client for Etsy's StatsD server and InfluxDB's Telegraf StatsD server.

Latest release

Supported Python versions

Wheel Status

Code: https://github.com/macobo/statshog

License: MIT; see LICENSE file

Issues: https://github.com/macobo/statshog/issues

Documentation: https://statshog.readthedocs.io/

Install

The easiest way to install statsd is with pip!

You can install from PyPI:

pip install statshog

Or GitHub:

$ pip install -e git+https://github.com/macobo/statshog#egg=statshog

Or from source:

git clone https://github.com/macobo/statshog
cd pystatsd
python setup.py install

Usage

Quick usage

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

Using with telegraf/influxdb

import statshog
statsd = statshog.StatsClient(telegraf=True)
statsd.timing('stats.timed', 320, tags={"mytag": 456})

Usage with django

Update your settings.py to have the following values if using non-defaults:

  • STATSD_HOST (default: 'localhost')
  • STATSD_PORT (default: 8125)
  • STATSD_PREFIX (default: None)
  • STATSD_MAXUDPSIZE (default: 512)
  • STATSD_IPV6 (default: False)
  • STATSD_TELEGRAF (default: False)
  • STATSD_SEPARATOR (default: '.')

Then, you can use statshog as following:

from statshog.defaults.django import statsd

statsd.timing('stats.timed', 320)

To use together with django-statsd, also add the following to your settings.py:

STATSD_CLIENT = "statshog"

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

statshog-1.0.6.tar.gz (26.7 kB view hashes)

Uploaded Source

Built Distribution

statshog-1.0.6-py2.py3-none-any.whl (13.9 kB view hashes)

Uploaded Python 2 Python 3

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