一种支持telegraf兼容标签的pystatsd分叉包。
statsd-telegraf的Python项目详细描述
statsd是Graphite的友好前端。这是一个python客户端 对于statsd守护进程。更具体地说,这是jsocol的一个分支 pystatsd客户机,增加了对dogtag兼容的支持 标签。
Code: | https://github.com/toddjames/statsd-tags |
---|---|
License: | MIT; see LICENSE file |
Issues: | https://github.com/toddjames/statsd-tags/issues |
Documentation: | https://statsd-tags.readthedocs.io/ |
快速使用:
>>>importstatsd>>>c=statsd.StatsClient('localhost',8125)>>>c.incr('foo')# Increment the 'foo' counter.>>>c.timing('stats.timed',320)# Record a 320ms 'stats.timed'.
您还可以在所有统计信息中添加前缀:
>>>importstatsd>>>c=statsd.StatsClient('localhost',8125,prefix='foo')>>>c.incr('bar')# Will be 'foo.bar' in statsd/graphite.
也支持与dogtag兼容的标记:
>>>importstatsd>>>c=statsd.StatsClient('localhost',8125)>>>c.gauge('baz',42,tags=['production','fqdn':'example.org'])
安装
安装statsd最简单的方法是使用pip!
您可以从pypi安装:
$ pip install statsd-tags
或github:
$ pip install -e git+https://github.com/toddjames/statsd-tags#egg=statsd
或来源:
$ git clone https://github.com/toddjames/statsd-tags $ cd statsd-tags $ python setup.py install
文档
在docs/目录和ReadTheDocs上有很多文档。