summaryrefslogtreecommitdiffstats
path: root/openstack/common/rpc/common.py
diff options
context:
space:
mode:
authorMatthew Sherborne <msherborne@gmail.com>2013-03-10 11:06:38 +1000
committerMatthew Sherborne <msherborne@gmail.com>2013-03-22 23:54:51 +1000
commit229b815fb72dccf998b18a0ad019cc61ccb888d8 (patch)
tree020044cb9cc461d183cf78bacdd6828e6119c5ae /openstack/common/rpc/common.py
parent727d784a0f732082497928798247f0e7ad4c0361 (diff)
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
Diffstat (limited to 'openstack/common/rpc/common.py')
-rw-r--r--openstack/common/rpc/common.py20
1 files changed, 19 insertions, 1 deletions
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 _('<unknown>'),
+ topic=topic or _('<unknown>'),
+ method=method or _('<unknown>'))
class DuplicateMessageError(RPCException):