From 62b22060c8bebae228a2ace7de783f61e5871b8c Mon Sep 17 00:00:00 2001 From: liusheng Date: Thu, 14 Apr 2016 15:00:11 +0800 Subject: [PATCH] Log the unique_id in listener than msg_id When use notify functionality of oslo.message, the message listener (message receiver) will log the msg_id, but the msg_id is only generated when send a RPC CALL message. So that many useless message like "received message msg_id: None reply to None" will be recorded in log file. This change will record the unique_id which is useful for tracing the messages from sender to receiver. Change-Id: I61a174b2af60e0e7fb61436d6e20d01b2c413c45 --- oslo_messaging/_drivers/amqpdriver.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/oslo_messaging/_drivers/amqpdriver.py b/oslo_messaging/_drivers/amqpdriver.py index 6989e5524..d96ede0dc 100644 --- a/oslo_messaging/_drivers/amqpdriver.py +++ b/oslo_messaging/_drivers/amqpdriver.py @@ -189,17 +189,13 @@ class AMQPListener(base.PollStyleListener): def __call__(self, message): ctxt = rpc_amqp.unpack_context(message) - - # FIXME(sileht): Don't log the message until strutils is more - # efficient, (rpc_amqp.unpack_context already log the context) - # LOG.debug(u'received: %s', - # strutils.mask_password(six.text_type(dict(message)))) - unique_id = self.msg_id_cache.check_duplicate_message(message) - - LOG.debug("received message msg_id: %(msg_id)s reply to %(queue)s", { - 'queue': ctxt.reply_q, 'msg_id': ctxt.msg_id}) - + if ctxt.msg_id: + LOG.debug("received message msg_id: %(msg_id)s reply to " + "%(queue)s", {'queue': ctxt.reply_q, + 'msg_id': ctxt.msg_id}) + else: + LOG.debug("received message with unique_id: %s", unique_id) self.incoming.append(AMQPIncomingMessage(self, ctxt.to_dict(), message,