diff options
author | Oleg Bondarev <obondarev@mirantis.com> | 2019-12-23 11:32:28 +0400 |
---|---|---|
committer | Oleg Bondarev <obondarev@mirantis.com> | 2020-01-23 15:37:31 +0400 |
commit | d7eb89eac8f76c46849f5e0d18a7ea00dc2d07bb (patch) | |
tree | 64766fea977b364d3b5bd4037fe7a6e42e832b72 | |
parent | 04b2b5d451df7d5aa4047a6b38aa364c400602a3 (diff) | |
download | oslo-messaging-d7eb89eac8f76c46849f5e0d18a7ea00dc2d07bb.tar.gz |
Don't log NoSuchMethod for special non-existing methods
Such non-existing methods are used as health probes.
Please see bug for details.
Change-Id: I8f6b4a669ec11721f76cf03abcd7d802c3c11eb5
Closes-Bug: #1857319
-rw-r--r-- | oslo_messaging/rpc/server.py | 12 | ||||
-rw-r--r-- | releasenotes/notes/no-log-if-ignore-errors-e2223b8a646b4c40.yaml | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/oslo_messaging/rpc/server.py b/oslo_messaging/rpc/server.py index b16d77f..d981b88 100644 --- a/oslo_messaging/rpc/server.py +++ b/oslo_messaging/rpc/server.py @@ -164,12 +164,18 @@ class RPCServer(msg_server.MessageHandlingServer): try: res = self.dispatcher.dispatch(message) except rpc_dispatcher.ExpectedException as e: + # current sys.exc_info() content can be overridden + # by another exception raised by a log handler during + # LOG.debug(). So keep a copy and delete it later. failure = e.exc_info LOG.debug(u'Expected exception during message handling (%s)', e) + except rpc_dispatcher.NoSuchMethod as e: + failure = sys.exc_info() + if e.method.endswith('_ignore_errors'): + LOG.debug('Method %s not found', e.method) + else: + LOG.exception('Exception during message handling') except Exception: - # current sys.exc_info() content can be overridden - # by another exception raised by a log handler during - # LOG.exception(). So keep a copy and delete it later. failure = sys.exc_info() LOG.exception('Exception during message handling') diff --git a/releasenotes/notes/no-log-if-ignore-errors-e2223b8a646b4c40.yaml b/releasenotes/notes/no-log-if-ignore-errors-e2223b8a646b4c40.yaml new file mode 100644 index 0000000..84365cc --- /dev/null +++ b/releasenotes/notes/no-log-if-ignore-errors-e2223b8a646b4c40.yaml @@ -0,0 +1,5 @@ +other: + - | + NoSuchMethod exception will not be logged for special non-existing methods + which names end with '_ignore_errors'. Such methods might be used + as health probes for openstack services. |