diff options
Diffstat (limited to 'kamon-system-metrics/src/main/scala/kamon')
-rw-r--r-- | kamon-system-metrics/src/main/scala/kamon/metrics/CPUMetrics.scala | 16 | ||||
-rw-r--r-- | kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsCollector.scala | 1 |
2 files changed, 11 insertions, 6 deletions
diff --git a/kamon-system-metrics/src/main/scala/kamon/metrics/CPUMetrics.scala b/kamon-system-metrics/src/main/scala/kamon/metrics/CPUMetrics.scala index ef7f225c..20789039 100644 --- a/kamon-system-metrics/src/main/scala/kamon/metrics/CPUMetrics.scala +++ b/kamon-system-metrics/src/main/scala/kamon/metrics/CPUMetrics.scala @@ -31,31 +31,33 @@ object CPUMetrics extends MetricGroupCategory { case object System extends MetricIdentity { val name = "system" } case object Wait extends MetricIdentity { val name = "wait" } case object Idle extends MetricIdentity { val name = "idle" } + case object Stolen extends MetricIdentity { val name = "stolen" } - case class CPUMetricRecorder(user: Histogram, system: Histogram, cpuWait: Histogram, idle: Histogram) + case class CPUMetricRecorder(user: Histogram, system: Histogram, cpuWait: Histogram, idle: Histogram, stolen: Histogram) extends MetricGroupRecorder { def collect(context: CollectionContext): MetricGroupSnapshot = { - CPUMetricSnapshot(user.collect(context), system.collect(context), cpuWait.collect(context), idle.collect(context)) + CPUMetricSnapshot(user.collect(context), system.collect(context), cpuWait.collect(context), idle.collect(context), stolen.collect(context)) } def cleanup: Unit = {} } - case class CPUMetricSnapshot(user: Histogram.Snapshot, system: Histogram.Snapshot, cpuWait: Histogram.Snapshot, idle: Histogram.Snapshot) + case class CPUMetricSnapshot(user: Histogram.Snapshot, system: Histogram.Snapshot, cpuWait: Histogram.Snapshot, idle: Histogram.Snapshot, stolen: Histogram.Snapshot) extends MetricGroupSnapshot { type GroupSnapshotType = CPUMetricSnapshot def merge(that: CPUMetricSnapshot, context: CollectionContext): GroupSnapshotType = { - CPUMetricSnapshot(user.merge(that.user, context), system.merge(that.system, context), cpuWait.merge(that.cpuWait, context), idle.merge(that.idle, context)) + CPUMetricSnapshot(user.merge(that.user, context), system.merge(that.system, context), cpuWait.merge(that.cpuWait, context), idle.merge(that.idle, context), stolen.merge(that.stolen, context)) } lazy val metrics: Map[MetricIdentity, MetricSnapshot] = Map( User -> user, System -> system, Wait -> cpuWait, - Idle -> idle) + Idle -> idle, + Stolen -> stolen) } val Factory = CPUMetricGroupFactory @@ -74,11 +76,13 @@ case object CPUMetricGroupFactory extends MetricGroupFactory { val systemConfig = settings.getConfig("system") val cpuWaitConfig = settings.getConfig("wait") val idleConfig = settings.getConfig("idle") + val stolenConfig = settings.getConfig("stolen") new CPUMetricRecorder( Histogram.fromConfig(userConfig), Histogram.fromConfig(systemConfig), Histogram.fromConfig(cpuWaitConfig), - Histogram.fromConfig(idleConfig)) + Histogram.fromConfig(idleConfig), + Histogram.fromConfig(stolenConfig)) } } diff --git a/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsCollector.scala b/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsCollector.scala index 2fe66a43..b1ebf402 100644 --- a/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsCollector.scala +++ b/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsCollector.scala @@ -68,6 +68,7 @@ class SystemMetricsCollector(collectInterval: FiniteDuration) extends Actor with cpur.system.record(toLong(cpuPerc.getSys)) cpur.cpuWait.record(toLong(cpuPerc.getWait)) cpur.idle.record(toLong(cpuPerc.getIdle)) + cpur.stolen.record(toLong(cpuPerc.getStolen)) } private def recordProcessCpu(pcpur: ProcessCPUMetricsRecorder) = { |