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
This commit is contained in:
liusheng 2016-04-14 15:00:11 +08:00
parent 0b286754e2
commit 62b22060c8

View File

@ -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,