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
This commit is contained in:
Oleg Bondarev 2019-12-23 11:32:28 +04:00
parent 04b2b5d451
commit d7eb89eac8
2 changed files with 15 additions and 4 deletions

View File

@ -164,12 +164,18 @@ class RPCServer(msg_server.MessageHandlingServer):
try:
res = self.dispatcher.dispatch(message)
except rpc_dispatcher.ExpectedException as e:
failure = e.exc_info
LOG.debug(u'Expected exception during message handling (%s)', e)
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.
# 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:
failure = sys.exc_info()
LOG.exception('Exception during message handling')

View File

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