@@ -234,7 +234,7 @@ func (op *AddonOperator) Setup() error {
234234 return fmt .Errorf ("global hooks directory: %s" , err )
235235 }
236236 log .Info ("global hooks directory" ,
237- slog .String ("dir" , globalHooksDir ))
237+ slog .String (pkg . LogKeyDir , globalHooksDir ))
238238
239239 tempDir , err := ensureTempDirectory (shapp .TempDir )
240240 if err != nil {
@@ -443,7 +443,7 @@ func (op *AddonOperator) BootstrapMainQueue(tqs *queue.TaskQueueSet) {
443443 tqs .NewNamedQueue ("main" , op .TaskService .Handle ,
444444 queue .WithCompactionCallback (queueutils .CompactionCallback (op .ModuleManager , op .Logger )),
445445 queue .WithCompactableTypes (queueutils .MergeTasks ... ),
446- queue .WithLogger (op .Logger .With ("operator.component" , "mainQueue" )),
446+ queue .WithLogger (op .Logger .With (pkg . LogKeyOperatorComponent , "mainQueue" )),
447447 )
448448
449449 tasks := op .CreateBootstrapTasks (logLabels )
@@ -457,7 +457,7 @@ func (op *AddonOperator) BootstrapMainQueue(tqs *queue.TaskQueueSet) {
457457 // Add "DiscoverHelmReleases" task to detect unknown releases and purge them.
458458 // this task will run only after the first converge, to keep all modules
459459 discoverLabels := utils .MergeLabels (logLabels , map [string ]string {
460- "queue" : "main" ,
460+ pkg . LogKeyQueue : "main" ,
461461 pkg .LogKeyBinding : string (task .DiscoverHelmReleases ),
462462 })
463463 discoverTask := sh_task .NewTask (task .DiscoverHelmReleases ).
@@ -482,10 +482,10 @@ func (op *AddonOperator) CreateBootstrapTasks(logLabels map[string]string) []sh_
482482
483483 for _ , hookName := range onStartupHooks {
484484 hookLogLabels := utils .MergeLabels (logLabels , map [string ]string {
485- pkg .LogKeyHook : hookName ,
486- "hook.type" : "global" ,
487- "queue" : "main" ,
488- pkg .LogKeyBinding : string (htypes .OnStartup ),
485+ pkg .LogKeyHook : hookName ,
486+ pkg . LogKeyHookType : "global" ,
487+ pkg . LogKeyQueue : "main" ,
488+ pkg .LogKeyBinding : string (htypes .OnStartup ),
489489 })
490490
491491 onStartupBindingContext := bc.BindingContext {Binding : string (htypes .OnStartup )}
@@ -509,10 +509,10 @@ func (op *AddonOperator) CreateBootstrapTasks(logLabels map[string]string) []sh_
509509 schedHooks := op .ModuleManager .GetGlobalHooksInOrder (htypes .Schedule )
510510 for _ , hookName := range schedHooks {
511511 hookLogLabels := utils .MergeLabels (logLabels , map [string ]string {
512- pkg .LogKeyHook : hookName ,
513- "hook.type" : "global" ,
514- "queue" : "main" ,
515- pkg .LogKeyBinding : string (task .GlobalHookEnableScheduleBindings ),
512+ pkg .LogKeyHook : hookName ,
513+ pkg . LogKeyHookType : "global" ,
514+ pkg . LogKeyQueue : "main" ,
515+ pkg .LogKeyBinding : string (task .GlobalHookEnableScheduleBindings ),
516516 })
517517
518518 newTask := sh_task .NewTask (task .GlobalHookEnableScheduleBindings ).
@@ -529,10 +529,10 @@ func (op *AddonOperator) CreateBootstrapTasks(logLabels map[string]string) []sh_
529529 kubeHooks := op .ModuleManager .GetGlobalHooksInOrder (htypes .OnKubernetesEvent )
530530 for _ , hookName := range kubeHooks {
531531 hookLogLabels := utils .MergeLabels (logLabels , map [string ]string {
532- pkg .LogKeyHook : hookName ,
533- "hook.type" : "global" ,
534- "queue" : "main" ,
535- pkg .LogKeyBinding : string (task .GlobalHookEnableKubernetesBindings ),
532+ pkg .LogKeyHook : hookName ,
533+ pkg . LogKeyHookType : "global" ,
534+ pkg . LogKeyQueue : "main" ,
535+ pkg .LogKeyBinding : string (task .GlobalHookEnableKubernetesBindings ),
536536 })
537537
538538 newTask := sh_task .NewTask (task .GlobalHookEnableKubernetesBindings ).
@@ -547,7 +547,7 @@ func (op *AddonOperator) CreateBootstrapTasks(logLabels map[string]string) []sh_
547547
548548 // Task to wait for kubernetes.Synchronization.
549549 waitLogLabels := utils .MergeLabels (logLabels , map [string ]string {
550- "queue" : "main" ,
550+ pkg . LogKeyQueue : "main" ,
551551 pkg .LogKeyBinding : string (task .GlobalHookWaitKubernetesSynchronization ),
552552 })
553553 waitTask := sh_task .NewTask (task .GlobalHookWaitKubernetesSynchronization ).
@@ -560,7 +560,7 @@ func (op *AddonOperator) CreateBootstrapTasks(logLabels map[string]string) []sh_
560560
561561 // Add "ConvergeModules" task to run modules converge sequence for the first time.
562562 convergeLabels := utils .MergeLabels (logLabels , map [string ]string {
563- "queue" : "main" ,
563+ pkg . LogKeyQueue : "main" ,
564564 pkg .LogKeyBinding : string (task .ConvergeModules ),
565565 })
566566 convergeTask := converge .NewConvergeModulesTask (eventDescription , converge .OperatorStartup , convergeLabels )
@@ -574,13 +574,13 @@ func (op *AddonOperator) CreateAndStartParallelQueues() {
574574 for i := range app .NumberOfParallelQueues {
575575 queueName := fmt .Sprintf (app .ParallelQueueNamePattern , i )
576576 if op .IsQueueExists (queueName ) {
577- log .Warn ("Parallel queue already exists" , slog .String ("queue" , queueName ))
577+ log .Warn ("Parallel queue already exists" , slog .String (pkg . LogKeyQueue , queueName ))
578578 continue
579579 }
580580
581581 op .startQueue (queueName , op .TaskService .ParallelHandle )
582582 log .Debug ("Parallel queue started" ,
583- slog .String ("queue" , queueName ))
583+ slog .String (pkg . LogKeyQueue , queueName ))
584584 }
585585}
586586
@@ -594,7 +594,7 @@ func (op *AddonOperator) startQueue(queueName string, handler func(ctx context.C
594594 op .engine .TaskQueues .NewNamedQueue (queueName , handler ,
595595 queue .WithCompactionCallback (queueutils .CompactionCallback (op .ModuleManager , op .Logger )),
596596 queue .WithCompactableTypes (queueutils .MergeTasks ... ),
597- queue .WithLogger (op .Logger .With ("operator.component" , "queue" , "queue" , queueName )),
597+ queue .WithLogger (op .Logger .With (pkg . LogKeyOperatorComponent , "queue" , "queue" , queueName )),
598598 )
599599 op .engine .TaskQueues .GetByName (queueName ).Start (op .ctx )
600600}
@@ -615,7 +615,7 @@ func (op *AddonOperator) CreateAndStartQueuesForGlobalHooks() {
615615 op .CreateAndStartQueue (hookBinding .Queue )
616616
617617 log .Debug ("Queue started for global 'schedule' hook" ,
618- slog .String ("queue" , hookBinding .Queue ),
618+ slog .String (pkg . LogKeyQueue , hookBinding .Queue ),
619619 slog .String (pkg .LogKeyHook , hookName ))
620620 }
621621 }
@@ -624,7 +624,7 @@ func (op *AddonOperator) CreateAndStartQueuesForGlobalHooks() {
624624 op .CreateAndStartQueue (hookBinding .Queue )
625625
626626 log .Debug ("Queue started for global 'kubernetes' hook" ,
627- slog .String ("queue" , hookBinding .Queue ),
627+ slog .String (pkg . LogKeyQueue , hookBinding .Queue ),
628628 slog .String (pkg .LogKeyHook , hookName ))
629629 }
630630 }
@@ -647,7 +647,7 @@ func (op *AddonOperator) CreateAndStartQueuesForModuleHooks(moduleName string) {
647647 op .CreateAndStartQueue (hookBinding .Queue )
648648
649649 log .Debug ("Queue started for module 'schedule'" ,
650- slog .String ("queue" , hookBinding .Queue ),
650+ slog .String (pkg . LogKeyQueue , hookBinding .Queue ),
651651 slog .String (pkg .LogKeyHook , hook .GetName ()))
652652 }
653653 }
@@ -660,7 +660,7 @@ func (op *AddonOperator) CreateAndStartQueuesForModuleHooks(moduleName string) {
660660 op .CreateAndStartQueue (hookBinding .Queue )
661661
662662 log .Debug ("Queue started for module 'kubernetes'" ,
663- slog .String ("queue" , hookBinding .Queue ),
663+ slog .String (pkg . LogKeyQueue , hookBinding .Queue ),
664664 slog .String (pkg .LogKeyHook , hook .GetName ()))
665665 }
666666 }
@@ -697,8 +697,8 @@ func (op *AddonOperator) CreateReloadModulesTasks(moduleNames []string, logLabel
697697 }
698698
699699 newLogLabels := utils .MergeLabels (logLabels )
700- newLogLabels ["module" ] = moduleName
701- delete (newLogLabels , "task.id" )
700+ newLogLabels [pkg . LogKeyModule ] = moduleName
701+ delete (newLogLabels , pkg . LogKeyTaskID )
702702
703703 newTask := sh_task .NewTask (task .ModuleRun ).
704704 WithLogLabels (newLogLabels ).
0 commit comments