Prefixing the request id with 'req-' to decrease confusion when looking
at logs. Change-Id: Ic29b9c6b83c4572d17c0b48fb509063d279d3a78
This commit is contained in:
parent
6c898e6abf
commit
72f96b0d37
|
@ -59,7 +59,7 @@ class RequestContext(object):
|
|||
timestamp = utils.parse_strtime(timestamp)
|
||||
self.timestamp = timestamp
|
||||
if not request_id:
|
||||
request_id = unicode(uuid.uuid4())
|
||||
request_id = 'req-' + str(utils.gen_uuid())
|
||||
self.request_id = request_id
|
||||
self.auth_token = auth_token
|
||||
self.strategy = strategy
|
||||
|
|
|
@ -225,12 +225,22 @@ class RequestHeadersDeserializerTest(test.TestCase):
|
|||
class ResponseHeadersSerializerTest(test.TestCase):
|
||||
def test_request_id(self):
|
||||
serializer = wsgi.ResponseHeadersSerializer()
|
||||
|
||||
context = nova.context.get_admin_context()
|
||||
req = webob.Request.blank('/', environ={'nova.context': context})
|
||||
res = webob.Response(request=req)
|
||||
serializer.serialize(res, {}, 'foo')
|
||||
self.assertTrue(
|
||||
utils.is_uuid_like(res.headers['X-Compute-Request-Id']))
|
||||
h1 = res.headers.get('X-Compute-Request-Id')
|
||||
self.assertTrue(h1)
|
||||
|
||||
context = nova.context.get_admin_context()
|
||||
req = webob.Request.blank('/', environ={'nova.context': context})
|
||||
res = webob.Response(request=req)
|
||||
serializer.serialize(res, {}, 'foo')
|
||||
h2 = res.headers.get('X-Compute-Request-Id')
|
||||
self.assertTrue(h2)
|
||||
|
||||
self.assertNotEqual(h1, h2)
|
||||
|
||||
|
||||
class JSONSerializer(object):
|
||||
|
|
Loading…
Reference in New Issue