sven-lange-last commented on a change in pull request #4520: Log more 
diagnostic info when invoker / controller cluster status changes
URL: 
https://github.com/apache/incubator-openwhisk/pull/4520#discussion_r297172207
 
 

 ##########
 File path: 
core/controller/src/main/scala/org/apache/openwhisk/core/loadBalancer/ShardingContainerPoolBalancer.scala
 ##########
 @@ -542,7 +553,20 @@ case class ShardingContainerPoolBalancerState(
       _invokerSlots = _invokers.map { invoker =>
         new 
NestedSemaphore[FullyQualifiedEntityName](getInvokerSlot(invoker.id.userMemory).toMB.toInt)
       }
-      logging.info(this, s"loadbalancer cluster size changed to $actualSize 
active nodes.")(TransactionId.loadbalancer)
+      // Directly after startup, no invokers have registered yet. This needs 
to be handled gracefully.
+      val invokerCount = _invokers.size
+      val totalInvokerMemory =
+        _invokers.foldLeft(0L)((total, invoker) => total + 
getInvokerSlot(invoker.id.userMemory).toMB).MB
+      val averageInvokerMemory =
+        if (totalInvokerMemory.toMB > 0 && invokerCount > 0) {
+          (totalInvokerMemory / invokerCount).toMB.MB
+        } else {
+          0.MB
+        }
+      logging.info(
+        this,
+        s"loadbalancer cluster size changed to $actualSize active nodes. 
${invokerCount} invokers with ${averageInvokerMemory} average memory size - 
total invoker memory ${totalInvokerMemory}.")(
 
 Review comment:
   Makes sense - I will provide an update.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to