diff options
author | Diego <diegolparra@gmail.com> | 2016-03-03 00:47:53 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2016-03-03 00:47:53 -0300 |
commit | affe465fdcc002fb12c54b3bb139ba3ef4fb1d85 (patch) | |
tree | 36b69c34e1379eba3832bd24396256102cb76af8 /kamon-system-metrics/src/main/scala/kamon/system | |
parent | 8d47a512219714072b7cf9da8f40d8a69af56397 (diff) | |
download | Kamon-affe465fdcc002fb12c54b3bb139ba3ef4fb1d85.tar.gz Kamon-affe465fdcc002fb12c54b3bb139ba3ef4fb1d85.tar.bz2 Kamon-affe465fdcc002fb12c54b3bb139ba3ef4fb1d85.zip |
= system-metrics: runSafe in UlimitMetrics and include a test
Diffstat (limited to 'kamon-system-metrics/src/main/scala/kamon/system')
-rw-r--r-- | kamon-system-metrics/src/main/scala/kamon/system/jmx/MemoryUsageMetrics.scala | 6 | ||||
-rw-r--r-- | kamon-system-metrics/src/main/scala/kamon/system/sigar/ULimitMetrics.scala | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/kamon-system-metrics/src/main/scala/kamon/system/jmx/MemoryUsageMetrics.scala b/kamon-system-metrics/src/main/scala/kamon/system/jmx/MemoryUsageMetrics.scala index dff2c72e..aaf0eabd 100644 --- a/kamon-system-metrics/src/main/scala/kamon/system/jmx/MemoryUsageMetrics.scala +++ b/kamon-system-metrics/src/main/scala/kamon/system/jmx/MemoryUsageMetrics.scala @@ -32,8 +32,7 @@ import scala.collection.convert.WrapAsScala class MemoryUsageMetrics( instrumentFactory: InstrumentFactory, memoryUsageBeansWithNames: Iterable[MemoryUsageWithMetricName], - bufferPoolBeansWithNames: Iterable[BufferPoolWithMetricName] -) extends GenericEntityRecorder(instrumentFactory) { + bufferPoolBeansWithNames: Iterable[BufferPoolWithMetricName]) extends GenericEntityRecorder(instrumentFactory) { memoryUsageBeansWithNames.foreach { case MemoryUsageWithMetricName(name, beanFun) ⇒ gauge(name + "-used", Memory.Bytes, () ⇒ { @@ -112,6 +111,5 @@ object MemoryUsageMetrics extends JmxSystemMetricRecorderCompanion("jmx-memory") MemoryUsageWithMetricName("non-heap", () ⇒ memoryMXBean.getNonHeapMemoryUsage) :: MemoryUsageWithMetricName("heap", () ⇒ memoryMXBean.getHeapMemoryUsage) :: usagesWithNames, - bufferPoolsWithNames - ) + bufferPoolsWithNames) } diff --git a/kamon-system-metrics/src/main/scala/kamon/system/sigar/ULimitMetrics.scala b/kamon-system-metrics/src/main/scala/kamon/system/sigar/ULimitMetrics.scala index 314c8450..3d0812cb 100644 --- a/kamon-system-metrics/src/main/scala/kamon/system/sigar/ULimitMetrics.scala +++ b/kamon-system-metrics/src/main/scala/kamon/system/sigar/ULimitMetrics.scala @@ -10,11 +10,13 @@ class ULimitMetrics(sigar: Sigar, instrumentFactory: InstrumentFactory, logger: val openFiles = histogram("open-files") def update(): Unit = { - openFiles.record(sigar.getProcFd(pid).getTotal) + import SigarSafeRunner._ + + openFiles.record(runSafe(sigar.getProcFd(pid).getTotal, 0L, "open-files", logger)) } } object ULimitMetrics extends SigarMetricRecorderCompanion("ulimit") { def apply(sigar: Sigar, instrumentFactory: InstrumentFactory, logger: LoggingAdapter): ULimitMetrics = new ULimitMetrics(sigar, instrumentFactory, logger) -}
\ No newline at end of file +} |