diff options
author | Abhishek Kekane <abhishek.kekane@nttdata.com> | 2017-01-18 12:38:26 +0530 |
---|---|---|
committer | abhishekkekane <abhishek.kekane@nttdata.com> | 2017-02-22 01:49:22 +0530 |
commit | 87e4f7646faac97b179a71e4f2221ad646644535 (patch) | |
tree | 779c9df3991c7ac5fa1e7a86305d94daa3ad532c /glanceclient/common | |
parent | 1cd7030c8f124f14100aee6481f4d22105d029dd (diff) | |
download | python-glanceclient-87e4f7646faac97b179a71e4f2221ad646644535.tar.gz |
x-openstack-request-id logged twice in logs
In the recent release of keystoneauth1 2.18.0 provision is made to log
x-openstack-request-id for session client. Once this new library is synced
in openstack projects, the x-openstack-request-id will be logged twice
on the console if session client is used.
For example,
$ glance --debug image-list
DEBUG:keystoneauth.session:GET call to image for
http://10.232.48.204:9292/v2/schemas/image used request id
req-96a3f203-c605-4c96-a31d-f1199d41705c
DEBUG:glanceclient.common.http:GET call to glance-api for
http://10.232.48.204:9292/v2/schemas/image used request id
req-96a3f203-c605-4c96-a31d-f1199d41705c
Above log will be logged twice on the console.
Removed logging of x-openstack-request-id in case of SessionClient as it
is already logged in keystoneauth1. x-openstack-request-id will only be
logged once on console if HTTPClient is used.
Depends-On: I492b331ff3da8d0b91178bf0d5fe1d3702f15bd7
Closes-Bug: #1657351
Change-Id: I64258f997dc060113f53682aee74bdd40a346e54
Diffstat (limited to 'glanceclient/common')
-rw-r--r-- | glanceclient/common/http.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py index 67a8d06..f169a23 100644 --- a/glanceclient/common/http.py +++ b/glanceclient/common/http.py @@ -92,16 +92,6 @@ class _BaseHTTPClient(object): return data 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: LOG.debug("Request returned failure status %s.", resp.status_code) raise exc.from_response(resp, resp.content) @@ -274,6 +264,16 @@ class HTTPClient(_BaseHTTPClient): {'endpoint': endpoint, 'e': e}) raise exc.CommunicationError(message=message) + # 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 image for ' + '%(url)s used request id ' + '%(response_request_id)s', + {'method': resp.request.method, + 'url': resp.url, + 'response_request_id': request_id}) + resp, body_iter = self._handle_response(resp) self.log_http_response(resp) return resp, body_iter |