Disable request_id absence warning

Glare prints warnings into logs when request_id is
not specified in user context. But when the service
is used outside of OpenStack it's normal behavior
and logs confuse operators.

So, it's better to remove this warning and prevent
logs clogging with such warnings.

Change-Id: Ia588d5a2f067ae1333284b2def9b6612bc493cea
This commit is contained in:
Mike Fedosin 2017-06-22 12:19:35 +03:00 committed by Idan Narotzki
parent 7d1466991c
commit d6309b6b9b
1 changed files with 2 additions and 3 deletions

View File

@ -70,9 +70,6 @@ class BaseContextMiddleware(base_middleware.ConfigurableMiddleware):
def process_response(resp, request=None):
try:
request_id = resp.request.context.request_id
except AttributeError:
LOG.warning('Unable to retrieve request id from context')
else:
# For python 3 compatibility need to use bytes type
prefix = b'req-' if isinstance(request_id, bytes) else 'req-'
@ -80,6 +77,8 @@ class BaseContextMiddleware(base_middleware.ConfigurableMiddleware):
request_id = prefix + request_id
resp.headers['x-openstack-request-id'] = request_id
except AttributeError:
pass
return resp