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

vvraskin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 1d8e7c5  Enable Kamon System Metrics module (#4213)
1d8e7c5 is described below

commit 1d8e7c50f4e7a939997205372b7ec741a78be2ad
Author: Chetan Mehrotra <[email protected]>
AuthorDate: Thu Jan 17 14:46:27 2019 +0530

    Enable Kamon System Metrics module (#4213)
    
    This PR enabled the export of JVM metrics via Kamon.
---
 common/scala/build.gradle                                          | 7 ++++++-
 common/scala/src/main/resources/application.conf                   | 4 ++++
 .../scala/src/main/scala/org/apache/openwhisk/common/Logging.scala | 5 +++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/common/scala/build.gradle b/common/scala/build.gradle
index 0a040b7..642816a 100644
--- a/common/scala/build.gradle
+++ b/common/scala/build.gradle
@@ -64,8 +64,13 @@ dependencies {
     compile 'com.github.ben-manes.caffeine:caffeine:2.6.2'
     compile 'com.google.code.findbugs:jsr305:3.0.2'
     compile 'io.fabric8:kubernetes-client:4.0.3'
-    compile 'io.kamon:kamon-core_2.12:1.1.3'
+    compile ('io.kamon:kamon-core_2.12:1.1.3') {
+        exclude group: 'com.lihaoyi'
+    }
     compile 'io.kamon:kamon-statsd_2.12:1.0.0'
+    compile ('io.kamon:kamon-system-metrics_2.12:1.0.0') {
+        exclude group: 'io.kamon', module: 'sigar-loader'
+    }
     //for mesos
     compile 'com.adobe.api.platform.runtime:mesos-actor:0.0.17'
 
diff --git a/common/scala/src/main/resources/application.conf 
b/common/scala/src/main/resources/application.conf
index 99cd688..2ae1a69 100644
--- a/common/scala/src/main/resources/application.conf
+++ b/common/scala/src/main/resources/application.conf
@@ -46,6 +46,10 @@ kamon {
 
         metric-key-generator = 
org.apache.openwhisk.common.WhiskStatsDMetricKeyGenerator
     }
+    system-metrics {
+        # disable the host metrics as we are only interested in JVM metrics
+        host.enabled = false
+    }
 
     reporters = [
         "kamon.statsd.StatsDReporter"
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 eca76a5..c45cb3f 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
@@ -26,6 +26,7 @@ import akka.event.LoggingAdapter
 import kamon.Kamon
 import kamon.metric.{Counter => KCounter, Histogram => KHistogram}
 import kamon.statsd.{MetricKeyGenerator, SimpleMetricKeyGenerator}
+import kamon.system.SystemMetrics
 import org.apache.openwhisk.core.entity.ControllerInstanceId
 
 trait Logging {
@@ -274,6 +275,10 @@ object LogMarkerToken {
 }
 
 object MetricEmitter {
+  if (TransactionId.metricsKamon) {
+    SystemMetrics.startCollecting()
+  }
+
   def emitCounterMetric(token: LogMarkerToken, times: Long = 1): Unit = {
     if (TransactionId.metricsKamon) {
       token.counter.increment(times)

Reply via email to