Statsd with Python
Sample scripts in Python to use statsd. See also Statsd with Perl.
examples/statsd/datadog_demo.py
import datadog import random import time for _ in range(10): time.sleep(random.random() * 2) elapsed_time = random.random() * 3 datadog.statsd.increment('demo.page_views') datadog.statsd.gauge('demo.elapsed_time', elapsed_time) datadog.statsd.histogram('demo.elapsed_time_histogram', elapsed_time)
examples/statsd/statsd_demo.py
import statsd import random import time c = statsd.StatsClient('localhost', 8125) for _ in range(10): time.sleep(random.random() * 2) elapsed_time = random.random() * 3 c.incr('demo.page_views') c.gauge('demo.elapsed_time', elapsed_time)
Published on 2018-10-20
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post