diff options
author | Diego <diegolparra@gmail.com> | 2015-08-10 00:55:01 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2015-08-10 00:55:01 -0300 |
commit | 820e96c9db1ecb2a88bcfb81f57f7f0c14d47f78 (patch) | |
tree | c81b00a4dcb68ce136416f12d2f16e281a7f9d38 /kamon-system-metrics/src/main/scala | |
parent | b2c218c100ee3a455f419ad6b0cff0dc68237288 (diff) | |
download | Kamon-820e96c9db1ecb2a88bcfb81f57f7f0c14d47f78.tar.gz Kamon-820e96c9db1ecb2a88bcfb81f57f7f0c14d47f78.tar.bz2 Kamon-820e96c9db1ecb2a88bcfb81f57f7f0c14d47f78.zip |
+ system-metrics: Allow disabling of system sigar and JVM JMX metrics in system-metrics module and closes #234
Diffstat (limited to 'kamon-system-metrics/src/main/scala')
-rw-r--r-- | kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsExtension.scala | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsExtension.scala b/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsExtension.scala index 94c6fefa..3f67b518 100644 --- a/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsExtension.scala +++ b/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsExtension.scala @@ -42,19 +42,25 @@ class SystemMetricsExtension(system: ExtendedActorSystem) extends Kamon.Extensio val config = system.settings.config.getConfig("kamon.system-metrics") val sigarFolder = config.getString("sigar-native-folder") val sigarRefreshInterval = config.getFiniteDuration("sigar-metrics-refresh-interval") + val sigarEnabled = config.getBoolean("sigar-enabled") + val jmxEnabled = config.getBoolean("jmx-enabled") val contextSwitchesRefreshInterval = config.getFiniteDuration("context-switches-refresh-interval") val metricsExtension = Kamon.metrics - SigarProvisioner.provision(new File(sigarFolder)) - - val supervisor = system.actorOf(SystemMetricsSupervisor.props(sigarRefreshInterval, contextSwitchesRefreshInterval), "kamon-system-metrics") + // OS Metrics collected with Sigar + if (sigarEnabled) { + SigarProvisioner.provision(new File(sigarFolder)) + system.actorOf(SystemMetricsSupervisor.props(sigarRefreshInterval, contextSwitchesRefreshInterval), "kamon-system-metrics") + } // JMX Metrics - ClassLoadingMetrics.register(metricsExtension) - GarbageCollectionMetrics.register(metricsExtension) - HeapMemoryMetrics.register(metricsExtension) - NonHeapMemoryMetrics.register(metricsExtension) - ThreadsMetrics.register(metricsExtension) + if (jmxEnabled) { + ClassLoadingMetrics.register(metricsExtension) + GarbageCollectionMetrics.register(metricsExtension) + HeapMemoryMetrics.register(metricsExtension) + NonHeapMemoryMetrics.register(metricsExtension) + ThreadsMetrics.register(metricsExtension) + } } class SystemMetricsSupervisor(sigarRefreshInterval: FiniteDuration, contextSwitchesRefreshInterval: FiniteDuration) extends Actor { |