From 86e779b11bff5f697adff06d999c5473357f8885 Mon Sep 17 00:00:00 2001 From: "ChangBo Guo(gcb)" Date: Thu, 13 Oct 2016 19:50:59 +0800 Subject: [PATCH] Record length of queues for ReplyWaiters Add the length of queues in warning message when it exceeds threshold. Change-Id: I6236720ede71fadac0c61baf792c15c69de3094b --- oslo_messaging/_drivers/amqpdriver.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/oslo_messaging/_drivers/amqpdriver.py b/oslo_messaging/_drivers/amqpdriver.py index f555eafad..5668b0371 100644 --- a/oslo_messaging/_drivers/amqpdriver.py +++ b/oslo_messaging/_drivers/amqpdriver.py @@ -248,11 +248,14 @@ class ReplyWaiters(object): def add(self, msg_id): self._queues[msg_id] = moves.queue.Queue() - if len(self._queues) > self._wrn_threshold: - LOG.warning(_LW('Number of call queues is greater than warning ' - 'threshold: %(old_threshold)s. There could be a ' - 'leak. Increasing threshold to: %(threshold)s'), - {'old_threshold': self._wrn_threshold, + queues_length = len(self._queues) + if queues_length > self._wrn_threshold: + LOG.warning(_LW('Number of call queues is %(queues_length)s, ' + 'greater than warning threshold: %(old_threshold)s' + '. There could be a leak. Increasing threshold to:' + ' %(threshold)s'), + {'queues_length': queues_length, + 'old_threshold': self._wrn_threshold, 'threshold': self._wrn_threshold * 2}) self._wrn_threshold *= 2