-
Notifications
You must be signed in to change notification settings - Fork 554
Add missing tenantid documentid #24795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing tenantid documentid #24795
Conversation
): string | undefined { | ||
let token: string | undefined; | ||
if (authorization) { | ||
const base64TokenMatch = authorization.match(/Basic (.+)/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you get this logic? Thanks. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On service side, this file is used for token validation logic
export function extractTokenFromHeader(authorizationHeader: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned in below comment, alfred and historian have different token format. So it could break existing code.
): string | undefined { | ||
let token: string | undefined; | ||
if (authorization) { | ||
const base64TokenMatch = authorization.match(/Basic (.+)/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to "basic", it can also be "Bearer"
966e215
to
691c7a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few perf related concerns here, especially with regards to a recent testing result that revealed performance degradations potentially caused by parsing tokens in this way.
server/routerlicious/packages/services-utils/src/morganLoggerMiddleware.ts
Outdated
Show resolved
Hide resolved
server/routerlicious/packages/services-utils/src/morganLoggerMiddleware.ts
Outdated
Show resolved
Hide resolved
server/routerlicious/packages/services-utils/src/morganLoggerMiddleware.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misclicked approve. Requesting changes to reset
server/routerlicious/packages/services-utils/src/morganLoggerMiddleware.ts
Outdated
Show resolved
Hide resolved
24a8867
to
47ebb48
Compare
This PR ensures that tenant ID and document ID are captured and logged even in cases where the server times out or returns a 499 error. Previously, these values were missing as shown in the below query https://dataexplorer.azure.com/clusters/frspme.westus2/databases/FRS?query=H4sIAAAAAAAAA1WOQYvCQAyF7%2F6K0JOCIHsV6mVB9OIu1j8QZ1I70JnpJpmKsj9%2BOy2uekrIe9972R6rnWp3pJ9EojL7hWtDTEA9BT05PxzRd7ApAS9x%2FmEX744DeoKyhOIlpAAMFjxpE%2B2ofX9Vp%2BKfE%2BLemYnCtmayE0ChdxyDH1JHreNok1EXw5PtUJtPVLpEvo2mlY0mZURWa6WAQff2pSoZQyJ1arO5xlboqSlqkjxY5eq0gaIaPiPOuCTvkd2dwMQUdL6A8w0e%2BUt4lOZ9yvkDp%2FRrfEcBAAA%3D FRSHttpRequests | where eventTimestamp >= ago(1d) | where eventName == "HttpRequest" and method == "POST" | where service == "alfred" and environment == "production" | where pathCategory == "/documents/:tenantId" | where successful == false | where status startswith "Server" | summarize count() by tenantId, documentId, status --------- Co-authored-by: Sonali Deshpande <sonalideshpande@WIN-713HU8BVS0L.redmond.corp.microsoft.com> Co-authored-by: Sonali Deshpande <sdeshpande@microsoft.com>
This PR ensures that tenant ID and document ID are captured and logged even in cases where the server times out or returns a 499 error. Previously, these values were missing as shown in the below query
https://dataexplorer.azure.com/clusters/frspme.westus2/databases/FRS?query=H4sIAAAAAAAAA1WOQYvCQAyF7%2F6K0JOCIHsV6mVB9OIu1j8QZ1I70JnpJpmKsj9%2BOy2uekrIe9972R6rnWp3pJ9EojL7hWtDTEA9BT05PxzRd7ApAS9x%2FmEX744DeoKyhOIlpAAMFjxpE%2B2ofX9Vp%2BKfE%2BLemYnCtmayE0ChdxyDH1JHreNok1EXw5PtUJtPVLpEvo2mlY0mZURWa6WAQff2pSoZQyJ1arO5xlboqSlqkjxY5eq0gaIaPiPOuCTvkd2dwMQUdL6A8w0e%2BUt4lOZ9yvkDp%2FRrfEcBAAA%3D
FRSHttpRequests
| where eventTimestamp >= ago(1d)
| where eventName == "HttpRequest" and method == "POST"
| where service == "alfred" and environment == "production"
| where pathCategory == "/documents/:tenantId"
| where successful == false
| where status startswith "Server"
| summarize count() by tenantId, documentId, status