amqp: log time elapsed between receiving a message and replying
Change-Id: I1e64587cb76fe449fd0d60f78e830dc603574af5
This commit is contained in:
parent
e133c7e863
commit
12e27800b0
@ -21,6 +21,7 @@ import time
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import cachetools
|
import cachetools
|
||||||
|
from oslo_utils import timeutils
|
||||||
from six import moves
|
from six import moves
|
||||||
|
|
||||||
import oslo_messaging
|
import oslo_messaging
|
||||||
@ -46,6 +47,8 @@ class AMQPIncomingMessage(base.RpcIncomingMessage):
|
|||||||
self.msg_id = msg_id
|
self.msg_id = msg_id
|
||||||
self.reply_q = reply_q
|
self.reply_q = reply_q
|
||||||
self._obsolete_reply_queues = obsolete_reply_queues
|
self._obsolete_reply_queues = obsolete_reply_queues
|
||||||
|
self.stopwatch = timeutils.StopWatch()
|
||||||
|
self.stopwatch.start()
|
||||||
|
|
||||||
def _send_reply(self, conn, reply=None, failure=None, log_failure=True):
|
def _send_reply(self, conn, reply=None, failure=None, log_failure=True):
|
||||||
if not self._obsolete_reply_queues.reply_q_valid(self.reply_q,
|
if not self._obsolete_reply_queues.reply_q_valid(self.reply_q,
|
||||||
@ -63,10 +66,12 @@ class AMQPIncomingMessage(base.RpcIncomingMessage):
|
|||||||
unique_id = msg[rpc_amqp.UNIQUE_ID]
|
unique_id = msg[rpc_amqp.UNIQUE_ID]
|
||||||
|
|
||||||
LOG.debug("sending reply msg_id: %(msg_id)s "
|
LOG.debug("sending reply msg_id: %(msg_id)s "
|
||||||
"reply queue: %(reply_q)s", {
|
"reply queue: %(reply_q)s "
|
||||||
|
"time elapsed: %(elapsed)ss", {
|
||||||
'msg_id': self.msg_id,
|
'msg_id': self.msg_id,
|
||||||
'unique_id': unique_id,
|
'unique_id': unique_id,
|
||||||
'reply_q': self.reply_q})
|
'reply_q': self.reply_q,
|
||||||
|
'elapsed': self.stopwatch.elapsed()})
|
||||||
conn.direct_send(self.reply_q, rpc_common.serialize_msg(msg))
|
conn.direct_send(self.reply_q, rpc_common.serialize_msg(msg))
|
||||||
|
|
||||||
def reply(self, reply=None, failure=None, log_failure=True):
|
def reply(self, reply=None, failure=None, log_failure=True):
|
||||||
|
Loading…
Reference in New Issue
Block a user