You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2017/12/07 17:11:45 UTC

[GitHub] rabbah commented on a change in pull request #2968: add additional metrics and logs

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?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services