diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py index 1bec45cf..0eb42dec 100644 --- a/glanceclient/common/http.py +++ b/glanceclient/common/http.py @@ -120,6 +120,16 @@ class _BaseHTTPClient(object): except ValueError: 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 diff --git a/releasenotes/notes/log-request-id-e7f67a23a0ed5c7b.yaml b/releasenotes/notes/log-request-id-e7f67a23a0ed5c7b.yaml new file mode 100644 index 00000000..452246f8 --- /dev/null +++ b/releasenotes/notes/log-request-id-e7f67a23a0ed5c7b.yaml @@ -0,0 +1,6 @@ +--- +features: + - Added support to log 'x-openstack-request-id' for each api call. + Please refer, + https://blueprints.launchpad.net/python-glanceclient/+spec/log-request-id + for more details.