pip install statsd
python
from statsd import StatsClient
python
statsd_client = StatsClient(host='statsd.example.com', port=8125)
python
import time
def my_function():
start_time = time.time()
end_time = time.time()
statsd_client.timing('my_function.duration', elapsed_time)
python
def my_event_handler():
statsd_client.incr('my_event.count')
python
def my_queue_length(queue_length):
statsd_client.gauge('my_queue.length', queue_length)