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

feat: More verbose logging for audit #2503

Merged
merged 2 commits into from
Jan 12, 2023

Conversation

maxsmythe
Copy link
Contributor

Signed-off-by: Max Smythe smythe@google.com

What this PR does / why we need it:

This will help diagnose performance issues in audit, such as those mentioned in #2502

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #

Special notes for your reviewer:

Signed-off-by: Max Smythe <smythe@google.com>
@codecov-commenter
Copy link

Codecov Report

Base: 53.88% // Head: 53.91% // Increases project coverage by +0.03% 🎉

Coverage data is based on head (7676945) compared to base (bb11f3e).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2503      +/-   ##
==========================================
+ Coverage   53.88%   53.91%   +0.03%     
==========================================
  Files         116      116              
  Lines       10272    10277       +5     
==========================================
+ Hits         5535     5541       +6     
  Misses       4311     4311              
+ Partials      426      425       -1     
Flag Coverage Δ
unittests 53.91% <0.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/audit/manager.go 9.18% <0.00%> (-0.07%) ⬇️
...onstrainttemplate/constrainttemplate_controller.go 58.61% <0.00%> (+1.43%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sozercan
Copy link
Member

would we want any of these to be using debug? #1453

@@ -368,6 +368,7 @@ func (am *Manager) auditResources(
for gv, gvKinds := range clusterAPIResources {
kindsLoop:
for kind := range gvKinds {
log.Info("Listing objects for GVK", "group", gv.Group, "version", gv.Version, "kind", kind)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we want this line and the following to actual use the manager log? am.log. Before we call auditResources we actually tag the audit manager log w the auditID which could be used to aggregate audit runs.

https://github.com/open-policy-agent/gatekeeper/blob/master/pkg/audit/manager.go#L165

Copy link
Member

@ritazh ritazh Jan 11, 2023

Choose a reason for hiding this comment

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

but that one defaults to always log. +1 on exposing verbosity to the operator so it doesn't flood the logs unless you need it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, yes, am.log() is a better call.

@ritazh I think logging/not logging is governed by the log level flag?

Signed-off-by: Max Smythe <smythe@google.com>
@maxsmythe
Copy link
Contributor Author

addressed feedback

Copy link
Member

@sozercan sozercan left a comment

Choose a reason for hiding this comment

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

LGTM

@maxsmythe maxsmythe merged commit beb2432 into open-policy-agent:master Jan 12, 2023
davis-haba pushed a commit to davis-haba/gatekeeper that referenced this pull request Mar 7, 2023
* feat: More verbose logging for audit

Signed-off-by: Max Smythe <smythe@google.com>

* Reduce log priority

Signed-off-by: Max Smythe <smythe@google.com>

Signed-off-by: Max Smythe <smythe@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants