Expose 'get_previous_request_id' method

Registered by Abhishek Kekane

Each of the OpenStack Restful API returns X-Openstack-Request-Id in the API response but this request id is not available to the caller from the client. If you run command with —debug option, then only client displays the X-Openstack-Request-Id on the console. If there is any issue with the OS API and user wants to report this issue to the service provider, X-Openstack-Request-Id will come handy.

We are proposing to add get_previous_request_id() method in python-glanceclient.

Design:
When a caller make a call and get a response from the OpenStack service, it will extract
X-Openstack-Request-Id from the response header and store it in the thread local storage. Add a new method get_previous_request_id()’ in the client to return X-Openstack-Request-Id stored in the thread local storage to the caller. We need to store request id in the TLS because same client object could be used in multi-thread application to interact with the OpenStack services.

Example
from glanceclient import client

glance = client.Client('2', 'demo', 'admin', 'demo', 'http://21.12.4.342:5000/v2.0')

glance.images.list()
[<Image: 88c77848-ef8e-4d0a-9bbe-61ac41de0f0e>, <Image: 4b731517-2f3d-4c93-a580-77665585f8ca>]

glance.get_previous_request_id()
'req-a9b74258-0b21-49c2-8ce8-673b420e20cc'

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
Abhishek Kekane
Direction:
Needs approval
Assignee:
Abhishek Kekane
Definition:
Obsolete
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
Abhishek Kekane

Related branches

Sprints

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.