khvn26 / fastatsd

Python client for the statsd daemon. Can be used as a drop-in replacement for the usual statsd module.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fastatsd

This is a Python client for the statsd daemon, which can be used as a drop-in replacement for the statsd module.

Fastatsd is only tested with Python 3.5. There are no plans to support older Python versions.

Features

  • cystatsd is used to encode metrics.
  • Metrics are sent over the network in a worker thread to avoid blocking the main thread.

Example

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

The client also supports the context manager interface. This ensures that the worker thread sends all metrics on exit:

>>> import fastatsd
>>> with fastatsd.Fastatsd('localhost', 8125) as c:
>>>     c.incr('foo')

Installation

$ pip install cython
$ pip install -e git+https://github.com/qntln/cystatsd.git#egg=ql-cystatsd
$ pip install -e git+https://github.com/qntln/fastatsd.git#egg=fastatsd

About

Python client for the statsd daemon. Can be used as a drop-in replacement for the usual statsd module.

License:Other


Languages

Language:Python 100.0%