trbs/bucky

Add options to configure statsd timers

t3hk0d3 opened this issue · 2 comments

It would be great feature to disable some timer's metrics like sum, upper, lower, etc.

trbs commented

If somebody makes a PR for this, please make sure to include speed regressions tests.
Such a feature would be very welcome but should not (drastically) impact performance.

I've almost made this, by unit tests left me frustrated....they fail even on master branch with this error:

======================================================================
ERROR: test_001_statsd.test_timer_unsorted
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/tehkode/Projects/personal/bucky/tests/t.py", line 45, in run
    return func(*args, **kwargs)
  File "/Users/tehkode/Projects/personal/bucky/tests/t.py", line 45, in run
    return func(*args, **kwargs)
  File "/Users/tehkode/Projects/personal/bucky/tests/t.py", line 59, in run
    s = self.stype(q, cfg)
  File "/Users/tehkode/Projects/personal/bucky/bucky/statsd.py", line 396, in __init__
    super(StatsDServer, self).__init__(cfg.statsd_ip, cfg.statsd_port)
  File "/Users/tehkode/Projects/personal/bucky/bucky/udpserver.py", line 51, in __init__
    sys.exit(1)
SystemExit: 1
-------------------- >> begin captured logging << --------------------
bucky.udpserver: ERROR: Error binding socket 127.0.0.1:8130 - [Errno 48] Address already in use
Traceback (most recent call last):
  File "/Users/tehkode/Projects/personal/bucky/bucky/udpserver.py", line 47, in __init__
    self.sock.bind((ip, port))
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 48] Address already in use
--------------------- >> end captured logging << ---------------------

I've noticed failed tests cases share same port 8130.

Is there any special instruction how to run tests?

Also why does tests do whole-stack testing instead of just unit-testing.
I mean for each test case new UDP server is created, why just don't create StatsdHandler and invoke it directly from tests?