Skip to content

Commit

Permalink
fix(global): INFRA-296 try to get req.id from ingress headers
Browse files Browse the repository at this point in the history
  • Loading branch information
sitozzz committed Jun 4, 2024
1 parent 0a21dc7 commit 2ebd0c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .helm
Submodule .helm updated from 2cda77 to 63764c
8 changes: 4 additions & 4 deletions packages/keystone/KSv5v6/v5/prepareKeystone.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,14 @@ function prepareKeystone ({ onConnect, extendKeystoneConfig, extendExpressApp, s
app.use(function reqId (req, res, next) {

console.log('request headers', JSON.stringify(req.headers))
if (req.headers[requestIdHeaderName] !== undefined) {
console.log('found external X-Request-Id', req.headers[requestIdHeaderName])
if (req.headers[requestIdHeaderName.toLowerCase()] !== undefined) {
console.log('found external X-Request-Id', req.headers[requestIdHeaderName.toLowerCase()])
} else {
console.log('used to generate own X-Request-Id')
}

const reqId = req.headers[requestIdHeaderName] || v4()
console.log('reqId ', reqId, '; Checking equality with original ', req.headers['X-Request-Id'] === reqId)
const reqId = req.headers[requestIdHeaderName.toLowerCase()] || v4()
console.log('reqId ', reqId, '; Checking equality with original ', req.headers['x-request-id'] === reqId)
_internalGetExecutionContextAsyncLocalStorage().run({ reqId }, () => {
// we are expecting to receive reqId from client in order to have fully traced logs end to end
// also, property name are constant name, not a dynamic user input
Expand Down

0 comments on commit 2ebd0c0

Please sign in to comment.