Skip to content

feat: More verbose logging for audit#2503

Merged
maxsmythe merged 2 commits into
open-policy-agent:masterfrom
maxsmythe:verbose-audit
Jan 12, 2023
Merged

feat: More verbose logging for audit#2503
maxsmythe merged 2 commits into
open-policy-agent:masterfrom
maxsmythe:verbose-audit

Conversation

@maxsmythe
Copy link
Copy Markdown
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
Copy Markdown

codecov-commenter commented Jan 10, 2023

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Project coverage is 53.93%. Comparing base (bb11f3e) to head (80cbd43).
Report is 707 commits behind head on master.

Files with missing lines Patch % Lines
pkg/audit/manager.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2503      +/-   ##
==========================================
+ Coverage   53.88%   53.93%   +0.05%     
==========================================
  Files         116      116              
  Lines       10272    10277       +5     
==========================================
+ Hits         5535     5543       +8     
+ Misses       4311     4309       -2     
+ Partials      426      425       -1     
Flag Coverage Δ
unittests 53.93% <0.00%> (+0.05%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sozercan
Copy link
Copy Markdown
Member

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

Comment thread pkg/audit/manager.go Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

addressed feedback

Copy link
Copy Markdown
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.

5 participants