-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update log formatting in interceptors to use %+v #9501
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9501 +/- ##
=======================================
Coverage 67.04% 67.05%
=======================================
Files 202 202
Lines 28159 28155 -4
=======================================
- Hits 18880 18878 -2
+ Misses 7702 7697 -5
- Partials 1577 1580 +3 🚀 New features to boost your workflow:
|
| operation := filepath.Base(info.FullMethod) | ||
| newCtx, span := opentelemetry.Tracer().Start(AddRequestNameAndID(ctx, info.FullMethod), info.FullMethod) | ||
| log.Debugf(newCtx, "Request: %#v", req) | ||
| log.Debugf(newCtx, "Request: %T: %+v", req, req) |
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.
Good catch! Do we want to add a small integration test for this?
…ty of structs Signed-off-by: Ayato Tokubi <[email protected]>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bitoku, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cherry-pick release-1.34 |
|
@bitoku: new pull request created: #9503 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
The log format has changed since #9334 .
We changed the format from
%+vto%#vbecause we thought it sometimes failed to print structs, but it was actually because the structs didn't have values.For example, VersionRequest is sometimes like
&VersionRequest{Version:,}:In 1.33, it's printed with
%+vasbut since 1.34 (protobuf dependency change), it's printed
%+vasIt was not that
%+vfailed to print the struct, but it's just there's no fields to print.After the change from
%+vto%#v, some information was removed, For example, ContainerCreateRequest is printed with%#v:but with
%+v:So with
%#v,ConfigandSandboxConfigare hidden. This will make it harder to debug.This PR changes the format to
%+vagain, and added removed information about the type of request/response.You can compare how the logs changed by comparing at the ci-cgroupv2-e2e-features CI journal logs.
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?