Refactor metric collection

This change adds a generic queue onto which metrics can be pushed. A
separate module removes metrics from the queue and adds them to Cloudwatch.
Since these are now separate ideas, we can easily change the consumer from
Cloudwatch to anything else.

This change maintains near feature parity (the only change is there is now
just one queue instead of two - not a big deal).
This commit is contained in:
Matt Jibson 2015-08-11 16:39:33 -04:00
parent aee746bec6
commit cfb6e884f2
7 changed files with 46 additions and 147 deletions

11
util/saas/metricqueue.py Normal file
View file

@ -0,0 +1,11 @@
from Queue import Queue
class MetricQueue(object):
def __init__(self):
self._queue = Queue()
def put(self, *args, **kwargs):
self._queue.put((args, kwargs))
def get(self):
return self._queue.get()