You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ni...@apache.org on 2022/05/26 08:00:44 UTC

[openwhisk] 01/08: Add containerPool container histogram metric

This is an automated email from the ASF dual-hosted git repository.

ningyougang pushed a commit to branch add-container-count-metric
in repository https://gitbox.apache.org/repos/asf/openwhisk.git

commit 0c193ca6594ecb0b718c5fe3a3d256c46efc6f75
Author: ning.yougang <ni...@navercorp.com>
AuthorDate: Sun Apr 24 13:21:13 2022 +0800

    Add containerPool container histogram metric
---
 .../src/main/scala/org/apache/openwhisk/common/Logging.scala      | 3 ++-
 .../core/containerpool/v2/FunctionPullingContainerPool.scala      | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/common/scala/src/main/scala/org/apache/openwhisk/common/Logging.scala b/common/scala/src/main/scala/org/apache/openwhisk/common/Logging.scala
index caba798d7..53adfe23e 100644
--- a/common/scala/src/main/scala/org/apache/openwhisk/common/Logging.scala
+++ b/common/scala/src/main/scala/org/apache/openwhisk/common/Logging.scala
@@ -412,7 +412,8 @@ object LoggingMarkers {
     LogMarkerToken(invoker, "sharedPackage", counter, None, Map("path" -> path))(MeasurementUnit.none)
   def INVOKER_CONTAINERPOOL_MEMORY(state: String) =
     LogMarkerToken(invoker, "containerPoolMemory", counter, Some(state), Map("state" -> state))(MeasurementUnit.none)
-
+  def INVOKER_CONTAINERPOOL_CONTAINER(state: String) =
+    LogMarkerToken(invoker, "containerPoolContainer", counter, Some(state), Map("state" -> state))(MeasurementUnit.none)
   // System overload and random invoker assignment
   val MANAGED_SYSTEM_OVERLOAD =
     LogMarkerToken(controller, "managedInvokerSystemOverload", counter)(MeasurementUnit.none)
diff --git a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/v2/FunctionPullingContainerPool.scala b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/v2/FunctionPullingContainerPool.scala
index 07029814c..bfc65d33d 100644
--- a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/v2/FunctionPullingContainerPool.scala
+++ b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/v2/FunctionPullingContainerPool.scala
@@ -111,6 +111,14 @@ class FunctionPullingContainerPool(
     MetricEmitter
       .emitHistogramMetric(LoggingMarkers.INVOKER_CONTAINERPOOL_MEMORY("prewarmed"), memoryConsumptionOf(prewarmedPool))
     MetricEmitter.emitHistogramMetric(LoggingMarkers.INVOKER_CONTAINERPOOL_MEMORY("max"), poolConfig.userMemory.toMB)
+    val prewarmedSize = prewarmedPool.size
+    val busySize = busyPool.size
+    val warmedSize = warmedPool.size
+    val allSize = prewarmedSize + busySize + warmedSize
+    MetricEmitter.emitHistogramMetric(LoggingMarkers.INVOKER_CONTAINERPOOL_CONTAINER("prewarmed"), prewarmedSize)
+    MetricEmitter.emitHistogramMetric(LoggingMarkers.INVOKER_CONTAINERPOOL_CONTAINER("busy"), busySize)
+    MetricEmitter.emitHistogramMetric(LoggingMarkers.INVOKER_CONTAINERPOOL_CONTAINER("warmed"), warmedSize)
+    MetricEmitter.emitHistogramMetric(LoggingMarkers.INVOKER_CONTAINERPOOL_CONTAINER("all"), allSize)
   })
 
   // Key is ColdStartKey, value is the number of cold Start in minute