-
Notifications
You must be signed in to change notification settings - Fork 6.5k
chore(logs): standardize application logging (#20731) #21442
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
chore(logs): standardize application logging (#20731) #21442
Conversation
❗ Preview Environment undeploy from Bunnyshell failedSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
| GenericFunc: func(e event.GenericEvent) bool { | ||
| if log.IsLevelEnabled(log.DebugLevel) { | ||
| var appName string | ||
| logFields := log.Fields{"app": ""} |
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.
| logFields := log.Fields{"app": ""} | |
| logFields := log.Fields{} |
Probably fine to start with an empty set and replace it if the type assertion is successful.
9e268eb to
ad9ebdb
Compare
crenshaw-dev
left a comment
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.
Would you mind adding a quick note somewhere in the docs that these are standard log fields? Maybe in/around the "audit" documentation?
ad9ebdb to
b2fff65
Compare
No problem. I'm not sure where you would like me to put this though. Are you referring to this page https://argo-cd.readthedocs.io/en/stable/operator-manual/security/#auditing ? |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #21442 +/- ##
==========================================
- Coverage 59.98% 59.95% -0.03%
==========================================
Files 343 343
Lines 57846 57837 -9
==========================================
- Hits 34699 34679 -20
- Misses 20364 20372 +8
- Partials 2783 2786 +3 ☔ View full report in Codecov by Sentry. |
|
@dhawos yes I think that would be an okay place! |
b2fff65 to
79f44c9
Compare
Alright, I've added a quick note on those fields in the docs. Let me know if you would like any change. |
33688d0 to
ecbf780
Compare
|
Just rebased as some conflicts emerged and ensured CI was green. |
|
@crenshaw-dev, can you TAL, please? |
|
Probably worth presenting at the contributors meeting on Thursdays to facilitate the review. |
|
@dhawos, we got Michael ready to approve once the feedback is addressed. Can you follow-up when you have time, please? |
|
@dhawos, can you give some status update, please? It's okay if you don't have time right now to follow-up. |
ecbf780 to
2120b4a
Compare
Sorry I did not have access to my computer for some time. I'll try to resolve conflicts that emerged and address the feedback as soon as I can. |
7974056 to
498a38e
Compare
util/app/log/log.go
Outdated
| appv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1" | ||
| ) | ||
|
|
||
| func GetAppLog(app *appv1.Application) log.Fields { |
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.
Let's name this GetAppLogFields to make it more clear.
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 point, I've adressed it in my latest commit
util/app/log/log.go
Outdated
| return log.Fields{ | ||
| "application": app.Name, | ||
| "app-namespace": app.Namespace, | ||
| "app-qualified-name": app.QualifiedName(), |
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.
Let's remove this per Michael's comment
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.
Just removed it in my latest commit
cda4d93 to
ed83f45
Compare
Signed-off-by: Louis Gérard <[email protected]>
Signed-off-by: Louis Gérard <[email protected]>
327e915 to
0352914
Compare
…oj#21442) Signed-off-by: Louis Gérard <[email protected]> Signed-off-by: Lyheng <[email protected]>
…oj#21442) Signed-off-by: Louis Gérard <[email protected]>
…oj#21442) Signed-off-by: Louis Gérard <[email protected]>
…oj#21442) Signed-off-by: Louis Gérard <[email protected]> Signed-off-by: dsuhinin <[email protected]>
…oj#21442) Signed-off-by: Louis Gérard <[email protected]> Signed-off-by: dsuhinin <[email protected]>
I've tried implementing what was requested in #20731.
I moved the getAppLog function (that will return log.Fields when given an Application). From the application controller to the common utils. I'm not too sure if that's the right place for such a function so let me know if I should put it elsewhere.
I'm not sure I've found all the places where it could be used, but I searched through all usage of the
log.WithField(s)methods and changed those that were logging application details.I only changed places where an Application struct was available, I saw that in some places we had different structs (such as ApplicationQuery) but I wasn't sure that it was in scope so I did not change it.
I have not written any test since I'm not introducing any new logic but if you think some tests are relevant, I'd be glad to implement them.
Fixes #20731
Checklist: