Skip to content

Commit 1d8e7c5

Browse files
chetanmehvvraskin
authored andcommitted
Enable Kamon System Metrics module (#4213)
This PR enabled the export of JVM metrics via Kamon.
1 parent 408a06a commit 1d8e7c5

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

common/scala/build.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ dependencies {
6464
compile 'com.github.ben-manes.caffeine:caffeine:2.6.2'
6565
compile 'com.google.code.findbugs:jsr305:3.0.2'
6666
compile 'io.fabric8:kubernetes-client:4.0.3'
67-
compile 'io.kamon:kamon-core_2.12:1.1.3'
67+
compile ('io.kamon:kamon-core_2.12:1.1.3') {
68+
exclude group: 'com.lihaoyi'
69+
}
6870
compile 'io.kamon:kamon-statsd_2.12:1.0.0'
71+
compile ('io.kamon:kamon-system-metrics_2.12:1.0.0') {
72+
exclude group: 'io.kamon', module: 'sigar-loader'
73+
}
6974
//for mesos
7075
compile 'com.adobe.api.platform.runtime:mesos-actor:0.0.17'
7176

common/scala/src/main/resources/application.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ kamon {
4646

4747
metric-key-generator = org.apache.openwhisk.common.WhiskStatsDMetricKeyGenerator
4848
}
49+
system-metrics {
50+
# disable the host metrics as we are only interested in JVM metrics
51+
host.enabled = false
52+
}
4953

5054
reporters = [
5155
"kamon.statsd.StatsDReporter"

common/scala/src/main/scala/org/apache/openwhisk/common/Logging.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import akka.event.LoggingAdapter
2626
import kamon.Kamon
2727
import kamon.metric.{Counter => KCounter, Histogram => KHistogram}
2828
import kamon.statsd.{MetricKeyGenerator, SimpleMetricKeyGenerator}
29+
import kamon.system.SystemMetrics
2930
import org.apache.openwhisk.core.entity.ControllerInstanceId
3031

3132
trait Logging {
@@ -274,6 +275,10 @@ object LogMarkerToken {
274275
}
275276

276277
object MetricEmitter {
278+
if (TransactionId.metricsKamon) {
279+
SystemMetrics.startCollecting()
280+
}
281+
277282
def emitCounterMetric(token: LogMarkerToken, times: Long = 1): Unit = {
278283
if (TransactionId.metricsKamon) {
279284
token.counter.increment(times)

0 commit comments

Comments
 (0)