Skip to content

Commit 0c4ffdb

Browse files
dhawostylerrosnett
authored andcommitted
chore(logs): standardize application logging (argoproj#20731) (argoproj#21442)
Signed-off-by: Louis Gérard <[email protected]>
1 parent 66f7446 commit 0c4ffdb

File tree

12 files changed

+87
-83
lines changed

12 files changed

+87
-83
lines changed

applicationset/controllers/applicationset_controller.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import (
5151
"github.com/argoproj/argo-cd/v3/applicationset/status"
5252
"github.com/argoproj/argo-cd/v3/applicationset/utils"
5353
"github.com/argoproj/argo-cd/v3/common"
54+
applog "github.com/argoproj/argo-cd/v3/util/app/log"
5455
"github.com/argoproj/argo-cd/v3/util/db"
5556

5657
argov1alpha1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
@@ -577,7 +578,7 @@ func (r *ApplicationSetReconciler) createOrUpdateInCluster(ctx context.Context,
577578
var firstError error
578579
// Creates or updates the application in appList
579580
for _, generatedApp := range desiredApplications {
580-
appLog := logCtx.WithFields(log.Fields{"app": generatedApp.QualifiedName()})
581+
appLog := logCtx.WithFields(applog.GetAppLogFields(&generatedApp))
581582

582583
// Normalize to avoid fighting with the application controller.
583584
generatedApp.Spec = *argoutil.NormalizeApplicationSpec(&generatedApp.Spec)
@@ -740,7 +741,7 @@ func (r *ApplicationSetReconciler) deleteInCluster(ctx context.Context, logCtx *
740741
// Delete apps that are not in m[string]bool
741742
var firstError error
742743
for _, app := range current {
743-
logCtx = logCtx.WithField("app", app.QualifiedName())
744+
logCtx = logCtx.WithFields(applog.GetAppLogFields(&app))
744745
_, exists := m[app.Name]
745746

746747
if !exists {
@@ -1462,23 +1463,23 @@ func getApplicationOwnsHandler(enableProgressiveSyncs bool) predicate.Funcs {
14621463
// if we are the owner and there is a create event, we most likely created it and do not need to
14631464
// re-reconcile
14641465
if log.IsLevelEnabled(log.DebugLevel) {
1465-
var appName string
1466+
logFields := log.Fields{"app": ""}
14661467
app, isApp := e.Object.(*argov1alpha1.Application)
14671468
if isApp {
1468-
appName = app.QualifiedName()
1469+
logFields = applog.GetAppLogFields(app)
14691470
}
1470-
log.WithField("app", appName).Debugln("received create event from owning an application")
1471+
log.WithFields(logFields).Debugln("received create event from owning an application")
14711472
}
14721473
return false
14731474
},
14741475
DeleteFunc: func(e event.DeleteEvent) bool {
14751476
if log.IsLevelEnabled(log.DebugLevel) {
1476-
var appName string
1477+
logFields := log.Fields{"app": ""}
14771478
app, isApp := e.Object.(*argov1alpha1.Application)
14781479
if isApp {
1479-
appName = app.QualifiedName()
1480+
logFields = applog.GetAppLogFields(app)
14801481
}
1481-
log.WithField("app", appName).Debugln("received delete event from owning an application")
1482+
log.WithFields(logFields).Debugln("received delete event from owning an application")
14821483
}
14831484
return true
14841485
},
@@ -1487,7 +1488,7 @@ func getApplicationOwnsHandler(enableProgressiveSyncs bool) predicate.Funcs {
14871488
if !isApp {
14881489
return false
14891490
}
1490-
logCtx := log.WithField("app", appOld.QualifiedName())
1491+
logCtx := log.WithFields(applog.GetAppLogFields(appOld))
14911492
logCtx.Debugln("received update event from owning an application")
14921493
appNew, isApp := e.ObjectNew.(*argov1alpha1.Application)
14931494
if !isApp {
@@ -1499,12 +1500,12 @@ func getApplicationOwnsHandler(enableProgressiveSyncs bool) predicate.Funcs {
14991500
},
15001501
GenericFunc: func(e event.GenericEvent) bool {
15011502
if log.IsLevelEnabled(log.DebugLevel) {
1502-
var appName string
1503+
logFields := log.Fields{}
15031504
app, isApp := e.Object.(*argov1alpha1.Application)
15041505
if isApp {
1505-
appName = app.QualifiedName()
1506+
logFields = applog.GetAppLogFields(app)
15061507
}
1507-
log.WithField("app", appName).Debugln("received generic event from owning an application")
1508+
log.WithFields(logFields).Debugln("received generic event from owning an application")
15081509
}
15091510
return true
15101511
},

applicationset/controllers/applicationset_controller_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
argocommon "github.com/argoproj/argo-cd/v3/common"
3737
"github.com/argoproj/argo-cd/v3/pkg/apis/application"
3838
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
39+
applog "github.com/argoproj/argo-cd/v3/util/app/log"
3940
"github.com/argoproj/argo-cd/v3/util/db"
4041
"github.com/argoproj/argo-cd/v3/util/settings"
4142
)
@@ -1210,7 +1211,7 @@ func TestRemoveFinalizerOnInvalidDestination_FinalizerTypes(t *testing.T) {
12101211
clusterList, err := utils.ListClusters(t.Context(), kubeclientset, "namespace")
12111212
require.NoError(t, err)
12121213

1213-
appLog := log.WithFields(log.Fields{"app": app.Name, "appSet": ""})
1214+
appLog := log.WithFields(applog.GetAppLogFields(&app)).WithField("appSet", "")
12141215

12151216
appInputParam := app.DeepCopy()
12161217

@@ -1366,7 +1367,7 @@ func TestRemoveFinalizerOnInvalidDestination_DestinationTypes(t *testing.T) {
13661367
clusterList, err := utils.ListClusters(t.Context(), kubeclientset, "argocd")
13671368
require.NoError(t, err)
13681369

1369-
appLog := log.WithFields(log.Fields{"app": app.Name, "appSet": ""})
1370+
appLog := log.WithFields(applog.GetAppLogFields(&app)).WithField("appSet", "")
13701371

13711372
appInputParam := app.DeepCopy()
13721373

controller/appcontroller.go

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import (
5454
"github.com/argoproj/argo-cd/v3/pkg/client/informers/externalversions/application/v1alpha1"
5555
applisters "github.com/argoproj/argo-cd/v3/pkg/client/listers/application/v1alpha1"
5656
"github.com/argoproj/argo-cd/v3/reposerver/apiclient"
57+
applog "github.com/argoproj/argo-cd/v3/util/app/log"
5758
"github.com/argoproj/argo-cd/v3/util/argo"
5859
argodiff "github.com/argoproj/argo-cd/v3/util/argo/diff"
5960
"github.com/argoproj/argo-cd/v3/util/argo/normalizers"
@@ -98,15 +99,6 @@ func (a CompareWith) Pointer() *CompareWith {
9899
return &a
99100
}
100101

101-
func getAppLog(app *appv1.Application) *log.Entry {
102-
return log.WithFields(log.Fields{
103-
"application": app.Name,
104-
"app-namespace": app.Namespace,
105-
"app-qualified-name": app.QualifiedName(),
106-
"project": app.Spec.Project,
107-
})
108-
}
109-
110102
// ApplicationController is the controller for application resources.
111103
type ApplicationController struct {
112104
cache *appstatecache.Cache
@@ -465,7 +457,7 @@ func (ctrl *ApplicationController) handleObjectUpdated(managedByApp map[string]b
465457
continue
466458
}
467459

468-
logCtx := getAppLog(app)
460+
logCtx := log.WithFields(applog.GetAppLogFields(app))
469461
// Enforce application's permission for the source namespace
470462
_, err = ctrl.getAppProj(app)
471463
if err != nil {
@@ -501,7 +493,7 @@ func (ctrl *ApplicationController) handleObjectUpdated(managedByApp map[string]b
501493
func (ctrl *ApplicationController) setAppManagedResources(destCluster *appv1.Cluster, a *appv1.Application, comparisonResult *comparisonResult) (*appv1.ApplicationTree, error) {
502494
ts := stats.NewTimingStats()
503495
defer func() {
504-
logCtx := getAppLog(a)
496+
logCtx := log.WithFields(applog.GetAppLogFields(a))
505497
for k, v := range ts.Timings() {
506498
logCtx = logCtx.WithField(k, v.Milliseconds())
507499
}
@@ -558,7 +550,7 @@ func isKnownOrphanedResourceExclusion(key kube.ResourceKey, proj *appv1.AppProje
558550
func (ctrl *ApplicationController) getResourceTree(destCluster *appv1.Cluster, a *appv1.Application, managedResources []*appv1.ResourceDiff) (*appv1.ApplicationTree, error) {
559551
ts := stats.NewTimingStats()
560552
defer func() {
561-
logCtx := getAppLog(a)
553+
logCtx := log.WithFields(applog.GetAppLogFields(a))
562554
for k, v := range ts.Timings() {
563555
logCtx = logCtx.WithField(k, v.Milliseconds())
564556
}
@@ -688,7 +680,7 @@ func (ctrl *ApplicationController) getResourceTree(destCluster *appv1.Cluster, a
688680
func (ctrl *ApplicationController) getAppHosts(destCluster *appv1.Cluster, a *appv1.Application, appNodes []appv1.ResourceNode) ([]appv1.HostInfo, error) {
689681
ts := stats.NewTimingStats()
690682
defer func() {
691-
logCtx := getAppLog(a)
683+
logCtx := log.WithFields(applog.GetAppLogFields(a))
692684
for k, v := range ts.Timings() {
693685
logCtx = logCtx.WithField(k, v.Milliseconds())
694686
}
@@ -1016,7 +1008,7 @@ func (ctrl *ApplicationController) processAppOperationQueueItem() (processNext b
10161008
return
10171009
}
10181010
app := origApp.DeepCopy()
1019-
logCtx := getAppLog(app)
1011+
logCtx := log.WithFields(applog.GetAppLogFields(app))
10201012
ts := stats.NewTimingStats()
10211013
defer func() {
10221014
for k, v := range ts.Timings() {
@@ -1180,7 +1172,7 @@ func (ctrl *ApplicationController) getPermittedAppLiveObjects(destCluster *appv1
11801172
}
11811173

11821174
func (ctrl *ApplicationController) finalizeApplicationDeletion(app *appv1.Application, projectClusters func(project string) ([]*appv1.Cluster, error)) error {
1183-
logCtx := getAppLog(app)
1175+
logCtx := log.WithFields(applog.GetAppLogFields(app))
11841176
// Get refreshed application info, since informer app copy might be stale
11851177
app, err := ctrl.applicationClientset.ArgoprojV1alpha1().Applications(app.Namespace).Get(context.Background(), app.Name, metav1.GetOptions{})
11861178
if err != nil {
@@ -1338,7 +1330,7 @@ func (ctrl *ApplicationController) updateFinalizers(app *appv1.Application) erro
13381330
}
13391331

13401332
func (ctrl *ApplicationController) setAppCondition(app *appv1.Application, condition appv1.ApplicationCondition) {
1341-
logCtx := getAppLog(app)
1333+
logCtx := log.WithFields(applog.GetAppLogFields(app))
13421334
// do nothing if app already has same condition
13431335
for _, c := range app.Status.Conditions {
13441336
if c.Message == condition.Message && c.Type == condition.Type {
@@ -1363,7 +1355,7 @@ func (ctrl *ApplicationController) setAppCondition(app *appv1.Application, condi
13631355
}
13641356

13651357
func (ctrl *ApplicationController) processRequestedAppOperation(app *appv1.Application) {
1366-
logCtx := getAppLog(app)
1358+
logCtx := log.WithFields(applog.GetAppLogFields(app))
13671359
var state *appv1.OperationState
13681360
// Recover from any unexpected panics and automatically set the status to be failed
13691361
defer func() {
@@ -1501,7 +1493,7 @@ func (ctrl *ApplicationController) processRequestedAppOperation(app *appv1.Appli
15011493
}
15021494

15031495
func (ctrl *ApplicationController) setOperationState(app *appv1.Application, state *appv1.OperationState) {
1504-
logCtx := getAppLog(app)
1496+
logCtx := log.WithFields(applog.GetAppLogFields(app))
15051497
if state.Phase == "" {
15061498
// expose any bugs where we neglect to set phase
15071499
panic("no phase was set")
@@ -1579,7 +1571,7 @@ func (ctrl *ApplicationController) setOperationState(app *appv1.Application, sta
15791571
// writeBackToInformer writes a just recently updated App back into the informer cache.
15801572
// This prevents the situation where the controller operates on a stale app and repeats work
15811573
func (ctrl *ApplicationController) writeBackToInformer(app *appv1.Application) {
1582-
logCtx := getAppLog(app).WithField("informer-writeBack", true)
1574+
logCtx := log.WithFields(applog.GetAppLogFields(app)).WithField("informer-writeBack", true)
15831575
err := ctrl.appInformer.GetStore().Update(app)
15841576
if err != nil {
15851577
logCtx.Errorf("failed to update informer store: %v", err)
@@ -1636,7 +1628,7 @@ func (ctrl *ApplicationController) processAppRefreshQueueItem() (processNext boo
16361628
return
16371629
}
16381630
app := origApp.DeepCopy()
1639-
logCtx := getAppLog(app).WithFields(log.Fields{
1631+
logCtx := log.WithFields(applog.GetAppLogFields(app)).WithFields(log.Fields{
16401632
"comparison-level": comparisonLevel,
16411633
"dest-server": origApp.Spec.Destination.Server,
16421634
"dest-name": origApp.Spec.Destination.Name,
@@ -1845,7 +1837,7 @@ func (ctrl *ApplicationController) processAppHydrateQueueItem() (processNext boo
18451837

18461838
ctrl.hydrator.ProcessAppHydrateQueueItem(origApp)
18471839

1848-
getAppLog(origApp).Debug("Successfully processed app hydrate queue item")
1840+
log.WithFields(applog.GetAppLogFields(origApp)).Debug("Successfully processed app hydrate queue item")
18491841
return
18501842
}
18511843

@@ -1894,7 +1886,7 @@ func currentSourceEqualsSyncedSource(app *appv1.Application) bool {
18941886
// Additionally, it returns whether full refresh was requested or not.
18951887
// If full refresh is requested then target and live state should be reconciled, else only live state tree should be updated.
18961888
func (ctrl *ApplicationController) needRefreshAppStatus(app *appv1.Application, statusRefreshTimeout, statusHardRefreshTimeout time.Duration) (bool, appv1.RefreshType, CompareWith) {
1897-
logCtx := getAppLog(app)
1889+
logCtx := log.WithFields(applog.GetAppLogFields(app))
18981890
var reason string
18991891
compareWith := CompareWithLatest
19001892
refreshType := appv1.RefreshTypeNormal
@@ -1972,7 +1964,7 @@ func (ctrl *ApplicationController) refreshAppConditions(app *appv1.Application)
19721964
// normalizeApplication normalizes an application.spec and additionally persists updates if it changed
19731965
func (ctrl *ApplicationController) normalizeApplication(orig, app *appv1.Application) {
19741966
app.Spec = *argo.NormalizeApplicationSpec(&app.Spec)
1975-
logCtx := getAppLog(app)
1967+
logCtx := log.WithFields(applog.GetAppLogFields(app))
19761968

19771969
patch, modified, err := diff.CreateTwoWayMergePatch(orig, app, appv1.Application{})
19781970

@@ -2006,7 +1998,7 @@ func createMergePatch(orig, new any) ([]byte, bool, error) {
20061998

20071999
// persistAppStatus persists updates to application status. If no changes were made, it is a no-op
20082000
func (ctrl *ApplicationController) persistAppStatus(orig *appv1.Application, newStatus *appv1.ApplicationStatus) (patchDuration time.Duration) {
2009-
logCtx := getAppLog(orig)
2001+
logCtx := log.WithFields(applog.GetAppLogFields(orig))
20102002
if orig.Status.Sync.Status != newStatus.Sync.Status {
20112003
message := fmt.Sprintf("Updated sync status: %s -> %s", orig.Status.Sync.Status, newStatus.Sync.Status)
20122004
ctrl.logAppEvent(context.TODO(), orig, argo.EventInfo{Reason: argo.EventReasonResourceUpdated, Type: corev1.EventTypeNormal}, message)
@@ -2059,7 +2051,7 @@ func (ctrl *ApplicationController) persistAppStatus(orig *appv1.Application, new
20592051

20602052
// autoSync will initiate a sync operation for an application configured with automated sync
20612053
func (ctrl *ApplicationController) autoSync(app *appv1.Application, syncStatus *appv1.SyncStatus, resources []appv1.ResourceStatus, revisionUpdated bool) (*appv1.ApplicationCondition, time.Duration) {
2062-
logCtx := getAppLog(app)
2054+
logCtx := log.WithFields(applog.GetAppLogFields(app))
20632055
ts := stats.NewTimingStats()
20642056
defer func() {
20652057
for k, v := range ts.Timings() {
@@ -2224,16 +2216,16 @@ func alreadyAttemptedSync(app *appv1.Application, commitSHA string, commitSHAsMS
22242216
return false, ""
22252217
}
22262218
} else {
2227-
log.WithField("application", app.Name).Debugf("Skipping auto-sync: commitSHA %s has no changes", commitSHA)
2219+
log.WithFields(applog.GetAppLogFields(app)).Debugf("Skipping auto-sync: commitSHA %s has no changes", commitSHA)
22282220
}
22292221
} else {
22302222
if revisionUpdated {
2231-
log.WithField("application", app.Name).Infof("Executing compare of syncResult.Revision and commitSha because manifest changed: %v", commitSHA)
2223+
log.WithFields(applog.GetAppLogFields(app)).Infof("Executing compare of syncResult.Revision and commitSha because manifest changed: %v", commitSHA)
22322224
if app.Status.OperationState.SyncResult.Revision != commitSHA {
22332225
return false, ""
22342226
}
22352227
} else {
2236-
log.WithField("application", app.Name).Debugf("Skipping auto-sync: commitSHA %s has no changes", commitSHA)
2228+
log.WithFields(applog.GetAppLogFields(app)).Debugf("Skipping auto-sync: commitSHA %s has no changes", commitSHA)
22372229
}
22382230
}
22392231

@@ -2297,7 +2289,7 @@ func (ctrl *ApplicationController) canProcessApp(obj any) bool {
22972289

22982290
if annotations := app.GetAnnotations(); annotations != nil {
22992291
if skipVal, ok := annotations[common.AnnotationKeyAppSkipReconcile]; ok {
2300-
logCtx := getAppLog(app)
2292+
logCtx := log.WithFields(applog.GetAppLogFields(app))
23012293
if skipReconcile, err := strconv.ParseBool(skipVal); err == nil {
23022294
if skipReconcile {
23032295
logCtx.Debugf("Skipping Application reconcile based on annotation %s", common.AnnotationKeyAppSkipReconcile)
@@ -2424,7 +2416,7 @@ func (ctrl *ApplicationController) newApplicationInformerAndLister() (cache.Shar
24242416
newApp, newOK := new.(*appv1.Application)
24252417
if oldOK && newOK {
24262418
if automatedSyncEnabled(oldApp, newApp) {
2427-
getAppLog(newApp).Info("Enabled automated sync")
2419+
log.WithFields(applog.GetAppLogFields(newApp)).Info("Enabled automated sync")
24282420
compareWith = CompareWithLatest.Pointer()
24292421
}
24302422
if ctrl.statusRefreshJitter != 0 && oldApp.ResourceVersion == newApp.ResourceVersion {

controller/health.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/argoproj/argo-cd/v3/common"
1414
"github.com/argoproj/argo-cd/v3/pkg/apis/application"
1515
appv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
16+
applog "github.com/argoproj/argo-cd/v3/util/app/log"
1617
"github.com/argoproj/argo-cd/v3/util/lua"
1718
)
1819

@@ -50,7 +51,7 @@ func setApplicationHealth(resources []managedResource, statuses []appv1.Resource
5051
errCount++
5152
savedErr = fmt.Errorf("failed to get resource health for %q with name %q in namespace %q: %w", res.Live.GetKind(), res.Live.GetName(), res.Live.GetNamespace(), err)
5253
// also log so we don't lose the message
53-
log.WithField("application", app.QualifiedName()).Warn(savedErr)
54+
log.WithFields(applog.GetAppLogFields(app)).Warn(savedErr)
5455
}
5556
}
5657

controller/hydrator/hydrator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1212

1313
commitclient "github.com/argoproj/argo-cd/v3/commitserver/apiclient"
14-
"github.com/argoproj/argo-cd/v3/controller/utils"
1514
appv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
1615
"github.com/argoproj/argo-cd/v3/reposerver/apiclient"
16+
applog "github.com/argoproj/argo-cd/v3/util/app/log"
1717
argoio "github.com/argoproj/argo-cd/v3/util/io"
1818
)
1919

@@ -55,7 +55,7 @@ func (h *Hydrator) ProcessAppHydrateQueueItem(origApp *appv1.Application) {
5555
return
5656
}
5757

58-
logCtx := utils.GetAppLog(app)
58+
logCtx := log.WithFields(applog.GetAppLogFields(app))
5959

6060
logCtx.Debug("Processing app hydrate queue item")
6161

@@ -130,7 +130,7 @@ func (h *Hydrator) ProcessHydrationQueueItem(hydrationKey HydrationQueueKey) (pr
130130
// in case we did.
131131
app.Status.SourceHydrator.CurrentOperation.DrySHA = drySHA
132132
h.dependencies.PersistAppHydratorStatus(origApp, &app.Status.SourceHydrator)
133-
logCtx = logCtx.WithField("app", app.QualifiedName())
133+
logCtx = logCtx.WithFields(applog.GetAppLogFields(app))
134134
logCtx.Errorf("Failed to hydrate app: %v", err)
135135
}
136136
return

controller/state.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
3535
appclientset "github.com/argoproj/argo-cd/v3/pkg/client/clientset/versioned"
3636
"github.com/argoproj/argo-cd/v3/reposerver/apiclient"
37+
applog "github.com/argoproj/argo-cd/v3/util/app/log"
3738
"github.com/argoproj/argo-cd/v3/util/app/path"
3839
"github.com/argoproj/argo-cd/v3/util/argo"
3940
argodiff "github.com/argoproj/argo-cd/v3/util/argo/diff"
@@ -314,7 +315,7 @@ func (m *appStateManager) GetRepoObjs(app *v1alpha1.Application, sources []v1alp
314315
}
315316

316317
ts.AddCheckpoint("manifests_ms")
317-
logCtx := log.WithField("application", app.QualifiedName())
318+
logCtx := log.WithFields(applog.GetAppLogFields(app))
318319
for k, v := range ts.Timings() {
319320
logCtx = logCtx.WithField(k, v.Milliseconds())
320321
}
@@ -550,8 +551,8 @@ func (m *appStateManager) CompareAppState(app *v1alpha1.Application, project *v1
550551
return nil, err
551552
}
552553

553-
logCtx := log.WithField("application", app.QualifiedName())
554-
logCtx.Infof("Comparing app state (cluster: %s, namespace: %s)", destCluster.Server, app.Spec.Destination.Namespace)
554+
logCtx := log.WithFields(applog.GetAppLogFields(app))
555+
logCtx.Infof("Comparing app state (cluster: %s, namespace: %s)", app.Spec.Destination.Server, app.Spec.Destination.Namespace)
555556

556557
var targetObjs []*unstructured.Unstructured
557558
now := metav1.Now()

0 commit comments

Comments
 (0)