API: Add x-openstack-request-id header

Registered by Brian Elliott

Create a request identifier associated with an API request that crosses OpenStack service boundaries. This will enable more effective debugging of requests that span multiple services. This will first be done in nova; use oslo components where possible so this can be more easily rolled-out to other OpenStack services.

The new header will be introduced for API v3, and will replace x-compute-request-id. It could also be added to v2, but would be in addition to x-compute-request-id, and both headers would have the same value.

- Upon receiving a request, use some middleware to generate a UUID to identify the request.
- This ID and the request ID of the other service will be logged at service boundaries. Create a module to provide a uniform way to the request ID mappings; the changes doing the actual logging will be covered by a future blueprint.
- The middleware used to generate the request ID will attach the x-openstack-request-id header to the response.

Blueprint information

John Garbutt
Brian Elliott
Chris Buccella
Series goal:
Accepted for juno
Milestone target:
milestone icon 2014.2
Started by
Russell Bryant
Completed by
Chris Buccella

Related branches



Feb. 10 Update:

We're narrowing the scope of this bp from what it was originally; this will now cover the preparation for logging request ID mappings in nova, but not the logging itself. There are a bunch of client changes that will be required, and those will be covered in a later blueprint. For now we just want to get the necessary middleware components and the x-openstack-request-id header into nova.

Discussion from the HK Summit:

Approving this for icehouse since we want to make this the default for v3 API. -- jogo (Feb 10, 2014)
Refinements from the ML:


Whenever a service makes a call to another service it logs with both the calling service request id and called service request id in the same log message. This should be a standard format across projects so it can be easily filtered. The request ID from each service will be sent in the x-openstack-request-id header. Middleware will be created to generate the request ID when nova receives a request. This value can then be subsequently used in logging. Before sending the response, the same middleware will attach the x-openstack-request-id header to the response with the previously-generated value.
Additionally, there will be an oslo module to log the request ID mapping in a uniform format, which will be used in a future blueprint.

--Chris Buccella


Apologies, this missed the deadline for Feature Freeze. Please rebase patches as soon as Juno opens, and we will try to get this in during that period. --johnthetubaguy (5th March 2014)

Unapproved - please re-submit via nova-spec --johnthetubagy (20th March 2014)

Marking this blueprint as definition: Drafting. If you are still working on this, please re-submit via nova-specs.

Gerrit topic: https://review.openstack.org/#q,topic:bp/to,n,z

Addressed by: https://review.openstack.org/84947
    Add x-openstack-request-id header

Approved, now nova-spec is approved. Looks to be ready for review, just needs a rebase. --johnthetubaguy

Merged Patches

Addressed by: https://review.openstack.org/65762
    Sync request_id middleware from nova

Addressed by: https://review.openstack.org/66903
    Add x-openstack-request-id to nova v3 responses


The change is for V3 only; V2 will not add the new header.


Work Items

Work items:
1.Create a common middleware in the oslo-incubator to set the request id in the request environment: DONE
2. Sync middleware from #1 into nova: DONE
3. Use middleware from #1: DONE