Log request_id for each api call
Blueprint [1] was implemented in the last Mitaka release cycle which returns request_id back to the caller as per design proposed in the cross-project specs [2].
Now, in step 2, we would like to log x-compute-
Following log message will be logged in debug logging level.
LOG.debug(
"used request_id '%(response_
method: HTTP request method (GET/POST/
my_service_name: Name of service processing the request (nova or nova-api in this case)
my_url: Request URL with endpoint
response_
The log messages logged by the log handlers would be dependant on how the root loggers are configured.
1. python-novaclient used as a shell command:
In this case, the root loggers will be configured in the client itself.
So if --debug flag is passed in the command, then following log message will be shown on console:-
DEBUG (session:195) GET call to nova for http://
Nothing will be logged on console if --debug flag is not set.
2. python-novaclient is used in another component (e.g. cinder, heat, etc.)
In this case, when another component calls apis of Nova service using python-novaclient, then following log message for get server api will be logged in another component's log file:-
DEBUG novaclient.
GET call to 'nova' for http://
used request_id 'req-33821d15-
In the above log message, you will see both nova (callee) and the caller's request_ids are logged in the same log message.
If the root loggers are configured in the caller and the same will be used by the client as well.
If the caller uses oslo.log library, it internally logs request_id using ContextFormatter configured in the "formatter_context" section of the caller's configuration file.
* The blueprint[3] for python-cinderclient has already been approved for Newton.
References:
[1] https:/
[2] http://
[3] https:/
Mailing List discussion:
http://
Blueprint information
- Status:
- Complete
- Approver:
- Matt Riedemann
- Priority:
- Low
- Drafter:
- Takashi Natsume
- Direction:
- Approved
- Assignee:
- Takashi Natsume
- Definition:
- Approved
- Series goal:
- Accepted for newton
- Implementation:
- Implemented
- Milestone target:
- None
- Started by
- Takashi Natsume
- Completed by
- Takashi Natsume
Related branches
Related bugs
Sprints
Whiteboard
This was approved during the newton summit. -- mriedem 20160429
Gerrit topic: https:/
Addressed by: https:/
Log request_id for each api call