Add x-openstack-request-id into Kuryr Logs
Add x-openstack-request-id into Kuryr Controller logs, whenever the Exception is raised. Change-Id: I25f82c85d936344fb37f1474e1fcd367e9477f8a
This commit is contained in:
parent
aae39f5011
commit
2700a8e586
|
@ -35,5 +35,12 @@ class LogExceptions(base.EventHandler):
|
|||
def __call__(self, event, *args, **kwargs):
|
||||
try:
|
||||
self._handler(event, *args, **kwargs)
|
||||
except self._exceptions:
|
||||
LOG.exception("Failed to handle event %s", event)
|
||||
except self._exceptions as ex:
|
||||
# If exception comes from OpenStack SDK and contains
|
||||
# 'request_id' then print this 'request_id' along the Exception.
|
||||
# This 'request_id' can be then used to search the OpenStack
|
||||
# service logs.
|
||||
req_id = ''
|
||||
if hasattr(ex, 'request_id'):
|
||||
req_id = f' [{ex.request_id}]'
|
||||
LOG.exception("Failed to handle event%s: %s", req_id, event)
|
||||
|
|
Loading…
Reference in New Issue