You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by cc...@apache.org on 2023/06/20 14:47:47 UTC

[yunikorn-core] branch master updated: [YUNIKORN-1827] Add core.application.usage logger (#575)

This is an automated email from the ASF dual-hosted git repository.

ccondit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 5f509ff8 [YUNIKORN-1827] Add core.application.usage logger (#575)
5f509ff8 is described below

commit 5f509ff8fb903c6e883211782f2f30c04a31ea50
Author: Craig Condit <cc...@apache.org>
AuthorDate: Tue Jun 20 09:47:33 2023 -0500

    [YUNIKORN-1827] Add core.application.usage logger (#575)
    
    Log the messages added by YUNIKORN-1385 (application aggregated resource
    tracking) so that they may be selectively enabled/disabled.
    
    Closes: #575
    
    Signed-off-by: Craig Condit <cc...@apache.org>
---
 pkg/log/logger.go                    | 6 ++++--
 pkg/log/logger_test.go               | 2 +-
 pkg/scheduler/objects/application.go | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/pkg/log/logger.go b/pkg/log/logger.go
index e3b52287..c08a534a 100644
--- a/pkg/log/logger.go
+++ b/pkg/log/logger.go
@@ -54,14 +54,16 @@ const (
 
 // Predefined loggers: when adding new loggers, ids must be sequential, and all must be added to the loggers slice in the same order
 var (
-	Core = &LoggerHandle{id: 1, name: "core"}
-	Test = &LoggerHandle{id: 2, name: "test"}
+	Core     = &LoggerHandle{id: 1, name: "core"}
+	Test     = &LoggerHandle{id: 2, name: "test"}
+	AppUsage = &LoggerHandle{id: 3, name: "core.application.usage"}
 )
 
 // this tracks all the known logger handles, used to preallocate the real logger instances when configuration changes
 var loggers = []*LoggerHandle{
 	Core,
 	Test,
+	AppUsage,
 }
 
 // structure to hold all current logger configuration state
diff --git a/pkg/log/logger_test.go b/pkg/log/logger_test.go
index 1e25037c..6fdbe29b 100644
--- a/pkg/log/logger_test.go
+++ b/pkg/log/logger_test.go
@@ -39,7 +39,7 @@ func TestLoggerIds(t *testing.T) {
 	_ = Logger()
 
 	// validate logger count
-	assert.Equal(t, 2, len(loggers), "wrong logger count")
+	assert.Equal(t, 3, len(loggers), "wrong logger count")
 
 	// validate that all loggers are populated and have sequential ids
 	for i := 0; i < len(loggers); i++ {
diff --git a/pkg/scheduler/objects/application.go b/pkg/scheduler/objects/application.go
index 9d061565..6c583533 100644
--- a/pkg/scheduler/objects/application.go
+++ b/pkg/scheduler/objects/application.go
@@ -125,7 +125,7 @@ type ApplicationSummary struct {
 }
 
 func (as *ApplicationSummary) DoLogging() {
-	log.Logger().Info("YK_APP_SUMMARY:",
+	log.Log(log.AppUsage).Info("YK_APP_SUMMARY:",
 		zap.String("appID", as.ApplicationID),
 		zap.Int64("submissionTime", as.SubmissionTime.UnixMilli()),
 		zap.Int64("startTime", as.StartTime.UnixMilli()),


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org