rabbah commented on a change in pull request #2968: add additional metrics and 
logs
URL: 
https://github.com/apache/incubator-openwhisk/pull/2968#discussion_r151433261
 
 

 ##########
 File path: 
core/invoker/src/main/scala/whisk/core/containerpool/ContainerPool.scala
 ##########
 @@ -78,27 +76,56 @@ class ContainerPool(childFactory: ActorRefFactory => 
ActorRef,
     }
   }
 
+  def logContainerStart(r: Run, containerState: String): Unit = {
+    val namespaceName = r.msg.user.namespace.name
+    val actionName = r.action.name.name
+    val activationId = r.msg.activationId.toString
+
+    logging.info(
+      this,
+      s"containerStart containerState: $containerState action: $actionName 
namespace: $namespaceName activationId: $activationId")(
+      r.msg.transid)
+    
MetricEmitter.emitCounterMetric(LoggingMarkers.INVOKER_CONTAINER_START(actionName,
 namespaceName, containerState))
+  }
+
   def receive: Receive = {
     // A job to run on a container
     case r: Run =>
       val container = if (busyPool.size < maxActiveContainers) {
+
         // Schedule a job to a warm container
         ContainerPool
           .schedule(r.action, r.msg.user.namespace, freePool)
+          .map(container => {
+            logContainerStart(r, "warm")
+            container
+          })
           .orElse {
             if (busyPool.size + freePool.size < maxPoolSize) {
-              takePrewarmContainer(r.action).orElse {
-                Some(createContainer())
-              }
+              takePrewarmContainer(r.action)
+                .map(container => {
+                  logContainerStart(r, "prewarmed")
 
 Review comment:
   @markusthoemmes can this moved to after returning the container to take the 
off the critical path?
   `andThen` here also?
   same below.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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