pip install statsd python from statsd import StatsClient client = StatsClient(host='localhost', port=8125) python client.incr('website.visits') python import time start_time = time.time() end_time = time.time() elapsed_time = end_time - start_time python client.gauge('website.cpu_usage', cpu_usage) python client.set('website.user_ids', user_id) python client = StatsClient(host='localhost', port=8125, ignore_exc=True) python hosts = [ {'host': 'server1', 'port': 8125}, {'host': 'server2', 'port': 8125}, {'host': 'server3', 'port': 8125} ] client = StatsClient(hosts=hosts)


上一篇:
下一篇:
切换中文