From 229b815fb72dccf998b18a0ad019cc61ccb888d8 Mon Sep 17 00:00:00 2001 From: Matthew Sherborne Date: Sun, 10 Mar 2013 11:06:38 +1000 Subject: Improves Logging for for rpc method timeouts This patch moves the traceback for an rpc timeout from inside an iterator, which gave a useless traceback, into the main flow of the program. It also adds the rpc method being called and the topic used to the exception's message. When the caller logs the message higher up the stack, the log information and traceback will be more useful. Finally it removes the timeout logging in the amqp.py module, in the spirit of bug #1137994 and https://review.openstack.org/#/c/23295/ Works towards: bug #1148516 Change-Id: I29a3b1b97c6114c4479e2b71c1257c4d72131535 --- openstack/common/rpc/common.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'openstack/common/rpc/common.py') diff --git a/openstack/common/rpc/common.py b/openstack/common/rpc/common.py index 5661bef..090bf5c 100644 --- a/openstack/common/rpc/common.py +++ b/openstack/common/rpc/common.py @@ -122,7 +122,25 @@ class Timeout(RPCException): This exception is raised if the rpc_response_timeout is reached while waiting for a response from the remote side. """ - message = _("Timeout while waiting on RPC response.") + message = _('Timeout while waiting on RPC response - ' + 'topic: "%(topic)s", RPC method: "%(method)s" ' + 'info: "%(info)s"') + + def __init__(self, info=None, topic=None, method=None): + """ + :param info: Extra info to convey to the user + :param topic: The topic that the rpc call was sent to + :param rpc_method_name: The name of the rpc method being + called + """ + self.info = info + self.topic = topic + self.method = method + super(Timeout, self).__init__( + None, + info=info or _(''), + topic=topic or _(''), + method=method or _('')) class DuplicateMessageError(RPCException): -- cgit