[EXPERIMENTAL] feat: improve log information #10665
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Improve logs by including more information in the log that is attached to the context.
NOTE: The PR just touches the minimum code to showcase how logs could appear. It's far from being finished. It still need changes in all the services, decisions on where to place some of the code, and additional polishing.
Related Issue
#10613
Motivation and Context
The information in the logs should be as homogeneous as possible. Most of the code is associated with a HTTP or GRPC request whose context might contain useful information that could be logged.
How Has This Been Tested?
For GRPC requests associated to our go-micro's services, the log expectation is the following:
The log happens when changing a user's role (the "error" level is just for easier visibility). Note that the log show information that is in the request's context, so there could be additional information not filled by us.
For GRPC requests associated to reva's services:
Note that the code is different because we're using the go's GRPC implementation and not a library on top of it. In addition, clients are created in reva, so we don't have control over them to inject our data (mostly client information).
The log happens opening a document with OnlyOffice or Collabora.
For HTTP requests:
This might not be a good example... We're logging most of the relevant request info, although it's unfortunate that the path's query is very long in this case (note that the access token is part of the url, so it's public anyway). WOPI context is chained afterwards, and finally additional information from the code path.
For all the HTTP requests, regardless of the service, the information should be the same until the "content-type" key. The rest of the information will be dependent on the specific service (for example, WOPI information in this case).
Screenshots (if appropriate):
Types of changes
Checklist:
NOTES: