Skip to content
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

Switch to go.uber.org/zap for JSON formatted logging #1145

Merged
merged 1 commit into from
May 24, 2022

Conversation

enj
Copy link
Contributor

@enj enj commented Apr 27, 2022

Signed-off-by: Monis Khan mok@vmware.com

Release note:

Pinniped server components now log using JSON by default.  The legacy format can be used by setting `log.format` to `text`.  The CLI now has a more friendly output format:

$ pinniped get kubeconfig
Tue, 24 May 2022 11:18:50 EDT  cmd/kubeconfig.go:584  discovered CredentialIssuer  {"name": "concierge-config"}
Tue, 24 May 2022 11:18:50 EDT  cmd/kubeconfig.go:419  discovered Concierge operating in impersonation proxy mode
Tue, 24 May 2022 11:18:50 EDT  cmd/kubeconfig.go:432  discovered Concierge endpoint  {"endpoint": "https://abcd"}
Tue, 24 May 2022 11:18:50 EDT  cmd/kubeconfig.go:447  discovered Concierge certificate authority bundle  {"roots": 1}
Tue, 24 May 2022 11:18:50 EDT  cmd/kubeconfig.go:469  discovered WebhookAuthenticator  {"name": "wa"}

@codecov
Copy link

codecov bot commented Apr 27, 2022

Codecov Report

Merging #1145 (08ff66e) into main (03ccef0) will increase coverage by 0.82%.
The diff coverage is 75.53%.

❗ Current head 08ff66e differs from pull request most recent head 0674215. Consider uploading reports for the commit 0674215 to get more accurate results

@@            Coverage Diff             @@
##             main    #1145      +/-   ##
==========================================
+ Coverage   79.30%   80.13%   +0.82%     
==========================================
  Files         141      139       -2     
  Lines       10240    10298      +58     
==========================================
+ Hits         8121     8252     +131     
+ Misses       1847     1770      -77     
- Partials      272      276       +4     
Impacted Files Coverage Δ
cmd/pinniped/cmd/root.go 0.00% <0.00%> (ø)
internal/concierge/server/server.go 25.39% <0.00%> (-0.62%) ⬇️
internal/config/supervisor/types.go 100.00% <ø> (ø)
internal/controller/kubecertagent/kubecertagent.go 91.86% <0.00%> (ø)
internal/controllerlib/controller.go 11.23% <0.00%> (ø)
internal/controllerlib/option.go 23.25% <0.00%> (ø)
internal/controllerlib/recorder.go 0.00% <0.00%> (ø)
internal/kubeclient/copied.go 38.88% <0.00%> (ø)
...l/localuserauthenticator/localuserauthenticator.go 53.53% <0.00%> (-3.67%) ⬇️
internal/upstreamoidc/upstreamoidc.go 88.38% <0.00%> (ø)
... and 36 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 03ccef0...0674215. Read the comment docs.

Copy link
Contributor Author

@enj enj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things to look at / discuss when reviewing.

cmd/pinniped/cmd/kubeconfig.go Outdated Show resolved Hide resolved
cmd/pinniped/cmd/login_oidc.go Outdated Show resolved Hide resolved
go.mod Show resolved Hide resolved
internal/config/concierge/types.go Show resolved Hide resolved
cmd/pinniped/cmd/login_oidc_test.go Outdated Show resolved Hide resolved
internal/plog/klog.go Outdated Show resolved Hide resolved
internal/plog/level.go Outdated Show resolved Hide resolved
internal/plog/level.go Outdated Show resolved Hide resolved
internal/plog/level_test.go Outdated Show resolved Hide resolved
internal/plog/level_test.go Outdated Show resolved Hide resolved
@enj
Copy link
Contributor Author

enj commented Apr 29, 2022

Summarizing feedback from Jeremy and Anjali:

  1. Made json the default
  2. Allow using the klog text based format (and ignore the zap console format)
  3. Deprecate the option to use the klog text format from the very beginning
  4. Before 1.0, and possibly sooner (i.e. if we build some functionality that relies on the zap logger such as redaction), the text based format will be removed (but we will make sure to give enough time for folks to migrate to json)

@cfryanr cfryanr mentioned this pull request May 9, 2022
internal/plog/level_test.go Outdated Show resolved Hide resolved
@netlify
Copy link

netlify bot commented May 20, 2022

👷 Deploy request for pinniped pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit ba5b896

@enj enj force-pushed the enj/f/json_logs branch 7 times, most recently from 4c2b5f1 to 7756a49 Compare May 23, 2022 20:59
Signed-off-by: Monis Khan <mok@vmware.com>
@enj enj enabled auto-merge May 24, 2022 15:37
@enj enj merged commit 75a32ae into vmware-tanzu:main May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants