-
Notifications
You must be signed in to change notification settings - Fork 77
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
Improve log tracing by sending 'X-VMWARE-VCLOUD-CLIENT-REQUEST-ID' header #656
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Didainius
commented
Mar 22, 2024
Didainius
commented
Mar 22, 2024
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
14cfb86
to
f3383e8
Compare
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
dataclouder
approved these changes
Apr 9, 2024
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.
Some minor issues in comments
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
adambarreiro
approved these changes
Apr 25, 2024
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
lvirbalas
approved these changes
Apr 26, 2024
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.
This is great!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR improves log traceability using VCD built-in functionality.
About the functionality itself
Whenever an HTTP client sends header
X-Vmware-Vcloud-Client-Request-Id
with a request, the response will have headerX-Vmware-Vcloud-Request-Id
that has a prefix (up to 128 chars) of what was sent toX-Vmware-Vcloud-Client-Request-Id
and additionally a suffix of hypen and UUIDv4.More about this in VCD docs: https://vdc-download.vmware.com/vmwb-repository/dcr-public/6ac8164c-8844-4188-ac1b-cd59721c06b8/7d36e490-310e-4485-91cc-c3abb23b0d32/GUID-0EAF1523-CA02-41FC-A7F3-B103108F5E4A.html
This is very useful for troubleshooting logs (especially when a lot of things are going in parallel like in the case of Terraform provider). It makes it easy to always find response to a particular request by simply searching of the part being sent.
Features in this PR
This PR adds infrastructure to send
X-Vmware-Vcloud-Client-Request-Id
header and also a functionVcloudRequestIdBuilderFunc
that can createX-Vmware-Vcloud-Client-Request-Id
headers in such format{sequence-number}-{date-time-hyphen-separated}-
. The sequence number is anuint64
that can support values up to1844674407370955161518446744073709551615
. The advantage of a sequence number is that it can help to understand order of requests going (and provide some sort of stats of total API requests made in the life of a program).Longer example:
A few inaccuracies are also fixed (both have comments inline):
setHttpUserAgent
in request manipulation functions