diff options
author | Diego <diegolparra@gmail.com> | 2014-08-16 23:13:56 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2014-08-16 23:13:56 -0300 |
commit | 92a258f5f5e54cde7c7c85bfd76a2f9d7c532551 (patch) | |
tree | 644f83355041021b3ed7a1e342bf50a740880ad5 /kamon-system-metrics/src/main/scala/kamon/metrics/ProcessCPUMetrics.scala | |
parent | 9fe3750f7cf8b3a85f7db8ebd1cc8daff097935e (diff) | |
download | Kamon-92a258f5f5e54cde7c7c85bfd76a2f9d7c532551.tar.gz Kamon-92a258f5f5e54cde7c7c85bfd76a2f9d7c532551.tar.bz2 Kamon-92a258f5f5e54cde7c7c85bfd76a2f9d7c532551.zip |
+ log-reporter: include Process Cpu metrics and closes #72
Diffstat (limited to 'kamon-system-metrics/src/main/scala/kamon/metrics/ProcessCPUMetrics.scala')
-rw-r--r-- | kamon-system-metrics/src/main/scala/kamon/metrics/ProcessCPUMetrics.scala | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/kamon-system-metrics/src/main/scala/kamon/metrics/ProcessCPUMetrics.scala b/kamon-system-metrics/src/main/scala/kamon/metrics/ProcessCPUMetrics.scala index 61f7ddb2..21f76a12 100644 --- a/kamon-system-metrics/src/main/scala/kamon/metrics/ProcessCPUMetrics.scala +++ b/kamon-system-metrics/src/main/scala/kamon/metrics/ProcessCPUMetrics.scala @@ -27,31 +27,31 @@ case class ProcessCPUMetrics(name: String) extends MetricGroupIdentity { object ProcessCPUMetrics extends MetricGroupCategory { val name = "proc-cpu" - case object User extends MetricIdentity { val name = "user" } - case object System extends MetricIdentity { val name = "system" } + case object CpuPercent extends MetricIdentity { val name = "cpu-percentage" } + case object TotalProcessTime extends MetricIdentity { val name = "total-process-time" } - case class ProcessCPUMetricsRecorder(user: Histogram, system: Histogram) + case class ProcessCPUMetricsRecorder(cpuPercent: Histogram, totalProcessTime: Histogram) extends MetricGroupRecorder { def collect(context: CollectionContext): MetricGroupSnapshot = { - ProcessCPUMetricsSnapshot(user.collect(context), system.collect(context)) + ProcessCPUMetricsSnapshot(cpuPercent.collect(context), totalProcessTime.collect(context)) } def cleanup: Unit = {} } - case class ProcessCPUMetricsSnapshot(user: Histogram.Snapshot, system: Histogram.Snapshot) + case class ProcessCPUMetricsSnapshot(cpuPercent: Histogram.Snapshot, totalProcessTime: Histogram.Snapshot) extends MetricGroupSnapshot { type GroupSnapshotType = ProcessCPUMetricsSnapshot def merge(that: ProcessCPUMetricsSnapshot, context: CollectionContext): GroupSnapshotType = { - ProcessCPUMetricsSnapshot(user.merge(that.user, context), system.merge(that.system, context)) + ProcessCPUMetricsSnapshot(cpuPercent.merge(that.cpuPercent, context), totalProcessTime.merge(that.totalProcessTime, context)) } lazy val metrics: Map[MetricIdentity, MetricSnapshot] = Map( - User -> user, - System -> system) + CpuPercent -> cpuPercent, + TotalProcessTime -> totalProcessTime) } val Factory = new MetricGroupFactory { @@ -61,12 +61,12 @@ object ProcessCPUMetrics extends MetricGroupCategory { def create(config: Config, system: ActorSystem): GroupRecorder = { val settings = config.getConfig("precision.system.process-cpu") - val userConfig = settings.getConfig("user") - val systemConfig = settings.getConfig("system") + val cpuPercentageConfig = settings.getConfig("cpu-percentage") + val totalProcessTimeConfig = settings.getConfig("total-process-time") new ProcessCPUMetricsRecorder( - Histogram.fromConfig(userConfig), - Histogram.fromConfig(systemConfig)) + Histogram.fromConfig(cpuPercentageConfig), + Histogram.fromConfig(totalProcessTimeConfig)) } } } |