Add tests for statsd prefix

This commit is contained in:
Scott Sanders 2014-09-12 14:45:29 -04:00
parent eb3bf34066
commit 88bc188407

View File

@ -77,3 +77,12 @@ def test_instrument():
t.eq(logger.sock.msgs[0], "gunicorn.request.duration:7000.0|ms")
t.eq(logger.sock.msgs[1], "gunicorn.requests:1|c|@1.0")
t.eq(logger.sock.msgs[2], "gunicorn.request.status.200:1|c|@1.0")
def test_prefix():
c = Config()
c.set("statsd_prefix", "test.")
logger = Statsd(c)
logger.sock = MockSocket(False)
logger.info("Blah", extra={"mtype": "gauge", "metric": "gunicorn.test", "value": 666})
t.eq(logger.sock.msgs[0], "test.gunicorn.test:666|g")