craigcondit commented on code in PR #968:
URL: https://github.com/apache/yunikorn-core/pull/968#discussion_r1761694671


##########
pkg/scheduler/objects/application.go:
##########
@@ -191,13 +190,15 @@ func NewApplication(siApp *si.AddApplicationRequest, ugi 
security.UserGroup, eve
        app.rmID = rmID
        app.appEvents = schedEvt.NewApplicationEvents(events.GetEventSystem())
        app.appEvents.SendNewApplicationEvent(app.ApplicationID)
-       app.setNewMetrics()
        return app
 }
 
-func (sa *Application) setNewMetrics() {
-       metrics.GetSchedulerMetrics().IncTotalApplicationsNew()
-       metrics.GetQueueMetrics(sa.GetQueuePath()).IncQueueApplicationsNew()
+func (sa *Application) SetNewMetrics() {
+       // ensure the queue is set before calling this function
+       if sa.GetQueuePath() != "" {

Review Comment:
   Don't add a conditional, just execute `setNewMetrics()` inside `SetQueue()`. 
Callers should not need to be updated at all.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to