I'm trying to send metrics to graphite from my python app through statsD, I'm using this client (which I understand is most common).
But I can't figure out how to send metrics with tags.
I've tried this syntax (from here):
c.incr('foo.bar,tag1=val')
And also this (got the idea from here):
c.incr('foo.bar;tag1=val')
But nothing seem to work.
Did anyone succeeded sending statsd metrics from python with tags?
Thanks
UPDATE:
It seems all you need to do now is to install:
pip install statsd-telegraf
See here
Works as expected
To send tags from python statsD you need to install this fork:
https://pypi.org/project/statsd-telegraf/
But, two important notes:
BAD: pip install statsd-tags
After installing from PyPI, Install directly from GitHub, using the correct username (In the PyPI link above, the wrong link is shown)
GOOD: pip install statsd-tags
pip install -e git+https://github.com/Granitosaurus/statsd-telegraf#egg=statsd-telegraf
Tags should be a dict. For example:
import statsd
c = statsd.StatsClient('localhost', 8125, prefix='foo')
c.incr('bar', tags = {"key1": "value1", "key2":"value2"})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With