YongGang commented on code in PR #14771:
URL: https://github.com/apache/druid/pull/14771#discussion_r1293861747


##########
extensions-contrib/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/KubernetesTaskRunner.java:
##########
@@ -370,13 +370,15 @@ public Optional<ScalingStats> getScalingStats()
   @Override
   public Map<String, Long> getIdleTaskSlotCount()
   {
-    return Collections.emptyMap();
+    // A negative return value indicates tasks are queued in the thread pool
+    // but have not been scheduled to run in K8s yet.
+    return ImmutableMap.of(WORKER_CATEGORY, Long.valueOf(config.getCapacity() 
- tasks.size()));
   }
 
   @Override
   public Map<String, Long> getUsedTaskSlotCount()
   {
-    return Collections.emptyMap();
+    return ImmutableMap.of(WORKER_CATEGORY, 
Long.valueOf(Math.min(config.getCapacity(), tasks.size())));

Review Comment:
   As long as it's not over capacity, I think the delay is minimum (like within 
a second, we consider peon job submitted/start as taskSlot being used). So 
operator can use this metric to decide whether need to add more resource if 
it's always same as `config.getCapacity()`



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to