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)