Merge "Log request-id before exceptions raised"
This commit is contained in:
@@ -92,6 +92,16 @@ class _BaseHTTPClient(object):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def _handle_response(self, resp):
|
def _handle_response(self, resp):
|
||||||
|
# log request-id for each api cal
|
||||||
|
request_id = resp.headers.get('x-openstack-request-id')
|
||||||
|
if request_id:
|
||||||
|
LOG.debug('%(method)s call to glance-api for '
|
||||||
|
'%(url)s used request id '
|
||||||
|
'%(response_request_id)s',
|
||||||
|
{'method': resp.request.method,
|
||||||
|
'url': resp.url,
|
||||||
|
'response_request_id': request_id})
|
||||||
|
|
||||||
if not resp.ok:
|
if not resp.ok:
|
||||||
LOG.debug("Request returned failure status %s." % resp.status_code)
|
LOG.debug("Request returned failure status %s." % resp.status_code)
|
||||||
raise exc.from_response(resp, resp.content)
|
raise exc.from_response(resp, resp.content)
|
||||||
@@ -120,16 +130,6 @@ class _BaseHTTPClient(object):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
body_iter = None
|
body_iter = None
|
||||||
|
|
||||||
# log request-id for each api call
|
|
||||||
request_id = resp.headers.get('x-openstack-request-id')
|
|
||||||
if request_id:
|
|
||||||
LOG.debug('%(method)s call to glance-api for '
|
|
||||||
'%(url)s used request id '
|
|
||||||
'%(response_request_id)s',
|
|
||||||
{'method': resp.request.method,
|
|
||||||
'url': resp.url,
|
|
||||||
'response_request_id': request_id})
|
|
||||||
|
|
||||||
return resp, body_iter
|
return resp, body_iter
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user