global_request_id is not set in the req.environ

Bug #1800978 reported by Tushar Patil
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.middleware
Invalid
Undecided
Neha Alhat

Bug Description

If I pass 'X-Openstack-Request-Id' in the request headers, RequestId oslo.middleware should set 'openstack.global_request_id' in the req.environ but it's not setting it correctly as it's getting 'HTTP_X_OPENSTACK_REQUEST_ID' in the request header instead of 'X-Openstack-Request-Id' due to which global_request_id is not logged in the nova-api service log file.

$curl -g -i -X GET http://172.16.114.130/compute/v2.1/servers/detail -H "Accept: application/json" -H "OpenStack-API-Version: compute 2.67" -H "User-Agent: python-novaclient" -H "X-Auth-Token: gAAAAABb2mTlsGotppBZn5JLLNHz0PqKObqOQPM6KioPpmbi2lfxM4h_PRn7W45RBjwDlfMRjCOu0DR9ogevlc9QORAq7eiG7HNy0MXiQa42lEtUBtlKtKl7VEHl8ZKd7TVMW-aDYb2DcEMxaXV2AesEzHNV9YWcvUMs4bN6f_j2OYw_VAQb07I" -H "X-OpenStack-Nova-API-Version: 2.67" -H "X-Openstack-Request-Id: e19f8f4f-40e7-441e-b776-7b43ed15c7dd"

Request headers
{
       .....
      'HTTP_X_AUTH_TOKEN':'gAAAAABb2mTlsGotppBZn5JLLNHz0PqKObqOQPM6KioPpmbi2lfxM4h_PRn7W45RBjwDlfMRjCOu0DR9ogevlc9QORAq7eiG7HNy0MXiQa42lEtUBtlKtKl7VEHl8ZKd7TVMW-aDYb2DcEMxaXV2AesEzHNV9YWcvUMs4bN6f_j2OYw_VAQb07I',
      'HTTP_USER_AGENT':'python-novaclient',
      'HTTP_X_OPENSTACK_NOVA_API_VERSION':'2.67',
      'HTTP_X_OPENSTACK_REQUEST_ID':'e19f8f4f-40e7-441e-b776-7b43ed15c7dd',
      'nova.best_content_type':'application/json'
   }
}

I have observed same issue with placement-api service. Both of these services uses webob framework.

I wrote a simple webob application [1] to check whether it adds prefix HTTP and converts it to uppercase or not and observed that webob is a culprit.

Not all OpenStack services uses webob framework. Flask doesn't modify HTTP headers. Maybe, we will need to modify RequestId middleware to handle both 'HTTP_X_OPENSTACK_REQUEST_ID' and 'X-Openstack-Request-Id' cases.

[1] : http://paste.openstack.org/show/733748/

Neha Alhat (nehaalhat)
Changed in oslo.middleware:
assignee: nobody → Neha Alhat (nehaalhat)
Revision history for this message
Tushar Patil (tpatil) wrote :

If you want to pass global_request_id in 'X-OpenStack-Request-Id' request header, then it should adhere to this format [1]. After passing correct uuid "eq-e19f8f4f-40e7-441e-b776-7b43ed15c7dd" in 'X-OpenStack-Request-Id' request header, I can see global_request_id in the respective service logs.

Marking this bug as invalid.

[1] : https://github.com/openstack/oslo.middleware/blob/master/oslo_middleware/request_id.py#L28

Changed in oslo.middleware:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.