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


##########
pkg/metrics/queue.go:
##########
@@ -57,6 +58,8 @@ type QueueMetrics struct {
        resourceMetricsLabel *prometheus.GaugeVec
        // Deprecated - To be removed in 1.7.0. Replaced with queue label 
Metrics
        resourceMetricsSubsystem *prometheus.GaugeVec
+       // Track known resource types.
+       knownResourceTypes map[string]struct{}

Review Comment:
   Need a lock here to guard access to knownResourceTypes.



##########
pkg/metrics/queue.go:
##########
@@ -301,12 +306,20 @@ func (m *QueueMetrics) AddReleasedContainers(value int) {
        
m.containerMetrics.WithLabelValues(ContainerReleased).Add(float64(value))
 }
 
-func (m *QueueMetrics) SetQueueGuaranteedResourceMetrics(resourceName string, 
value float64) {
-       m.setQueueResource(QueueGuaranteed, resourceName, value)
-}
+func (m *QueueMetrics) UpdateQueueResourceMetrics(state string, newResources 
map[string]resources.Quantity) {
+       // Iterate over new resource types and set their values.
+       for resourceName, value := range newResources {
+               m.setQueueResource(state, resourceName, float64(value))
+               // Add new resources to the known list
+               m.knownResourceTypes[resourceName] = struct{}{}

Review Comment:
   Guard this with a lock (see previous comment).



##########
pkg/metrics/queue.go:
##########
@@ -146,6 +150,7 @@ func (m *QueueMetrics) Reset() {
        m.appMetricsSubsystem.Reset()
        m.resourceMetricsLabel.Reset()
        m.resourceMetricsSubsystem.Reset()
+       m.knownResourceTypes = make(map[string]struct{})

Review Comment:
   Guard this with a lock (see previous comment).



-- 
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