def main(): pid = os.getpid() print "stats being recorded to /tmp/stats-pipe/%d.stats" % pid print "Try 'cat /tmp/stats-pipe/%d.stats'" % pid # Start the thread that will write out stats to the pipe. statvent.start_recorder() # Track a bunch of boring demo stats. i = 0 while True: i += 1 statvent.incr('foo.bar', 1) statvent.set('foo :: now', time.time()) statvent.record('foo->baz->{0}', random.uniform(0.0, 5.0)) if i % 50 == 0: print "tick ..." time.sleep(.1)
def test_record_appends_values_to_a_deque(): for i in range(3): statvent.record('this-n-that', i) assert statvent.stats._deques['this-n-that'] == deque([0,1,2])