Return request id to caller

Registered by Abhijeet Malawade

Most of the OpenStack Restful API returns X-Openstack-Request-Id in the API response header but this request id is not available to the caller from the openstacksdk. 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 'request-id' as attribute to resource objects in python-openstacksdk.

Design:
When a caller make a call and get a response from the OpenStack service, it will extract X-Openstack-Request-Id from the api response header and add it as attribute to the resource object. This resource object with request id is returned to user from openstacksdk.

Also need to add 'request-id' as attribute to exception object which will be raised from openstacksdk.

Example:

>>>from openstack import connection
>>>conn = connection.Connection(auth_url="https://10.69.4.179:5000/v2.0", project_name="demo", username="demo", password="admin")
>>>
>>>flavor = conn.compute.get_flavor('1')
>>>
>>>flavor
openstack.compute.v2.flavor.Flavor(attrs={u'name': u'm1.tiny', u'links': [{u'href': u'https://10.69.4.179:8774/v2/2dd1a6a2238148308d0350bb4a112b24/flavors/1', u'rel': u'self'}, {u'href':
u'https://10.69.4.179:8774/2dd1a6a2238148308d0350bb4a112b24/flavors/1', u'rel': u'bookmark'}], u'ram': 512, u'OS-FLV-DISABLED:disabled': False,
 'request-id': 'req-1784a36c-5aaf-4042-9ede-5076b67f2354', u'vcpus': 1, u'swap': u'', u'os-flavor-access:is_public': True,
u'rxtx_factor': 1.0, u'OS-FLV-EXT-DATA:ephemeral': 0, u'disk': 1, 'id': u'1'}, loaded=True)
>>>
>>># Get request id from flavor resource object
>>>flavor['request-id']
'req-1784a36c-5aaf-4042-9ede-5076b67f2354'

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Abhijeet Malawade
Direction:
Needs approval
Assignee:
Abhijeet Malawade
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

Return request ID to caller (openstack-spec) : https://review.openstack.org/#/c/156508/

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.