[placement] reorder middleware to correct logging context
The initial bug was that the initial 'Starting' log provided by requestlog had a different request id from the rest of the log messages for the same request. The initial assumption was that this was because a request id was not initially available, causing one to be generated for the first log entry that later was replaced by the request id middleware. In the process of debugging that it became clear that the id was in fact the request id of the previous request because the context was being reused under the covers in oslo_log and olso_context. Therefore the auth, context and request id middlewares are now changed to be active in the middleware stack before the request log middleware. The unfortunate side effect of this is that the Starting message and final request logging is no longer actually bounding the full request: it misses three critical middlewares. Change-Id: Ifa412973037193e4e67a0c9d2c71c7a4847980a9 Closes-Bug: #1626493
This commit is contained in:
parent
3e0e632463
commit
0b9b8981f2
@ -49,12 +49,20 @@ def deploy(conf, project_name):
|
||||
|
||||
application = handler.PlacementHandler()
|
||||
|
||||
for middleware in (context_middleware,
|
||||
auth_middleware,
|
||||
microversion_middleware,
|
||||
# NOTE(cdent): The ordering here is important. The list is ordered
|
||||
# from the inside out. For a single request req_id_middleware is called
|
||||
# first and microversion_middleware last. Then the request is finally
|
||||
# passed to the application (the PlacementHandler). At that point
|
||||
# the response ascends the middleware in the reverse of the
|
||||
# order the request went in. This order ensures that log messages
|
||||
# all see the same contextual information including request id and
|
||||
# authentication information.
|
||||
for middleware in (microversion_middleware,
|
||||
fault_wrap,
|
||||
req_id_middleware,
|
||||
request_log,
|
||||
context_middleware,
|
||||
auth_middleware,
|
||||
req_id_middleware,
|
||||
):
|
||||
application = middleware(application)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user