overflow metrics

This commit is contained in:
Jakob Ketterl 2019-09-15 12:23:35 +02:00
parent 7689d1a2e2
commit 392c226cbe
1 changed files with 7 additions and 1 deletions

View File

@ -53,11 +53,17 @@ class WsjtQueue(Queue):
metrics.addMetric("wsjt.queue.in", self.inCounter)
self.outCounter = CounterMetric()
metrics.addMetric("wsjt.queue.out", self.outCounter)
self.overflowCounter = CounterMetric()
metrics.addMetric("wsjt.queue.overflow", self.overflowCounter)
self.workers = [self.newWorker() for _ in range(0, workers)]
def put(self, item):
self.inCounter.inc()
super(WsjtQueue, self).put(item, block=False)
try:
super(WsjtQueue, self).put(item, block=False)
except Full:
self.overflowCounter.inc()
raise
def get(self, **kwargs):
# super.get() is blocking, so it would mess up the stats to inc() first