On Github ctaloc / statsd_presentation
Presentación realizada por Andrés Salazar / @andres_spinetti
>> from statsd import StatsClient >> foo_stats = StatsClient(prefix='foo') >> bar_stats = StatsClient(prefix='bar') >> foo_stats.incr('baz') >> bar_stats.incr('baz') >> statsd.decr('some.other.event') >> Decrease the counter by 5, 15% sample. >> statsd.decr('some.third.event', 5, rate=0.15)
>> import time >> from statsd import StatsClient >> statsd = StatsClient() >> start = time.time() >> time.sleep(3) # Lo convertimos a milisegundos: dt = int((time.time() - start) * 1000) # Enviamos a statsd statsd.timing('slept', dt)
>> statsd.gauge('foo', 70) # Seteamos 'foo' gauge a 70. >> statsd.gauge('foo', 1, delta=True) # Seteamos 'foo' a 71. >> statsd.gauge('foo', -3, delta=True) # Seteamos 'foo' a 68.
>> statsd.set(‘users’, userid)