mirror of
https://github.com/wassname/talk.git
synced 2026-10-30 13:50:47 +08:00
include trace ID in each downstream request
This commit is contained in:
1 parent
7f543f543b
commit
01039aa411
1 file changed
+4
@@ -3,5 +3,9 @@ const uuid = require('uuid/v1');
|
||||
// Trace middleware attaches a request id to each incoming request.
|
||||
module.exports = (req, res, next) => {
|
||||
req.id = uuid();
|
||||
|
||||
// Add the context ID to the request as an HTTP header.
|
||||
res.set('X-Talk-Trace-ID', req.id);
|
||||
|
||||
next();
|
||||
};
|
||||
Reference in new issue
Block a user