diff options
author | Boris Giftge <bgiftge@kixeye.com> | 2014-10-22 18:19:15 -0700 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2014-10-23 18:53:21 +0200 |
commit | 2bc964779fd260af550e7b40fbb2991d997ed000 (patch) | |
tree | 8c1b529c130f6f4cfeb0c490e41baffa1ba1c117 /kamon-core/src/main | |
parent | 52233d1ddef10b3c40df134b33f0d255dce85ae5 (diff) | |
download | Kamon-2bc964779fd260af550e7b40fbb2991d997ed000.tar.gz Kamon-2bc964779fd260af550e7b40fbb2991d997ed000.tar.bz2 Kamon-2bc964779fd260af550e7b40fbb2991d997ed000.zip |
= core,system.metrics: fixed serialization errors when using akka.actor.serialize-messages = on
Diffstat (limited to 'kamon-core/src/main')
6 files changed, 85 insertions, 60 deletions
diff --git a/kamon-core/src/main/scala/kamon/http/HttpServerMetrics.scala b/kamon-core/src/main/scala/kamon/http/HttpServerMetrics.scala index 3773e7d8..dfa4bcb8 100644 --- a/kamon-core/src/main/scala/kamon/http/HttpServerMetrics.scala +++ b/kamon-core/src/main/scala/kamon/http/HttpServerMetrics.scala @@ -82,11 +82,16 @@ object HttpServerMetrics extends MetricGroupIdentity { } } - val Factory = new MetricGroupFactory { - type GroupRecorder = HttpServerMetricsRecorder + val Factory = HttpServerMetricGroupFactory +} - def create(config: Config, system: ActorSystem): HttpServerMetricsRecorder = - new HttpServerMetricsRecorder() - } +case object HttpServerMetricGroupFactory extends MetricGroupFactory { + + import HttpServerMetrics._ + + type GroupRecorder = HttpServerMetricsRecorder + + def create(config: Config, system: ActorSystem): HttpServerMetricsRecorder = + new HttpServerMetricsRecorder() }
\ No newline at end of file diff --git a/kamon-core/src/main/scala/kamon/metric/ActorMetrics.scala b/kamon-core/src/main/scala/kamon/metric/ActorMetrics.scala index bb412f79..d2cb4e38 100644 --- a/kamon-core/src/main/scala/kamon/metric/ActorMetrics.scala +++ b/kamon-core/src/main/scala/kamon/metric/ActorMetrics.scala @@ -69,21 +69,25 @@ object ActorMetrics extends MetricGroupCategory { (Errors -> errors)) } - val Factory = new MetricGroupFactory { - type GroupRecorder = ActorMetricsRecorder + val Factory = ActorMetricGroupFactory +} - def create(config: Config, system: ActorSystem): ActorMetricsRecorder = { - val settings = config.getConfig("precision.actor") +case object ActorMetricGroupFactory extends MetricGroupFactory { + import ActorMetrics._ - val processingTimeConfig = settings.getConfig("processing-time") - val timeInMailboxConfig = settings.getConfig("time-in-mailbox") - val mailboxSizeConfig = settings.getConfig("mailbox-size") + type GroupRecorder = ActorMetricsRecorder - new ActorMetricsRecorder( - Histogram.fromConfig(processingTimeConfig), - Histogram.fromConfig(timeInMailboxConfig), - MinMaxCounter.fromConfig(mailboxSizeConfig, system), - Counter()) - } + def create(config: Config, system: ActorSystem): ActorMetricsRecorder = { + val settings = config.getConfig("precision.actor") + + val processingTimeConfig = settings.getConfig("processing-time") + val timeInMailboxConfig = settings.getConfig("time-in-mailbox") + val mailboxSizeConfig = settings.getConfig("mailbox-size") + + new ActorMetricsRecorder( + Histogram.fromConfig(processingTimeConfig), + Histogram.fromConfig(timeInMailboxConfig), + MinMaxCounter.fromConfig(mailboxSizeConfig, system), + Counter()) } } diff --git a/kamon-core/src/main/scala/kamon/metric/DispatcherMetrics.scala b/kamon-core/src/main/scala/kamon/metric/DispatcherMetrics.scala index fbce783c..126f6333 100644 --- a/kamon-core/src/main/scala/kamon/metric/DispatcherMetrics.scala +++ b/kamon-core/src/main/scala/kamon/metric/DispatcherMetrics.scala @@ -66,23 +66,28 @@ object DispatcherMetrics extends MetricGroupCategory { (PoolSize -> poolSize)) } - val Factory = new MetricGroupFactory { - type GroupRecorder = DispatcherMetricRecorder - - def create(config: Config, system: ActorSystem): DispatcherMetricRecorder = { - val settings = config.getConfig("precision.dispatcher") - - val maximumPoolSizeConfig = settings.getConfig("maximum-pool-size") - val runningThreadCountConfig = settings.getConfig("running-thread-count") - val queueTaskCountConfig = settings.getConfig("queued-task-count") - val poolSizeConfig = settings.getConfig("pool-size") - - new DispatcherMetricRecorder( - Histogram.fromConfig(maximumPoolSizeConfig), - Histogram.fromConfig(runningThreadCountConfig), - Histogram.fromConfig(queueTaskCountConfig), - Histogram.fromConfig(poolSizeConfig)) - } - } + val Factory = DispatcherMetricGroupFactory } +case object DispatcherMetricGroupFactory extends MetricGroupFactory { + + import DispatcherMetrics._ + + type GroupRecorder = DispatcherMetricRecorder + + def create(config: Config, system: ActorSystem): DispatcherMetricRecorder = { + val settings = config.getConfig("precision.dispatcher") + + val maximumPoolSizeConfig = settings.getConfig("maximum-pool-size") + val runningThreadCountConfig = settings.getConfig("running-thread-count") + val queueTaskCountConfig = settings.getConfig("queued-task-count") + val poolSizeConfig = settings.getConfig("pool-size") + + new DispatcherMetricRecorder( + Histogram.fromConfig(maximumPoolSizeConfig), + Histogram.fromConfig(runningThreadCountConfig), + Histogram.fromConfig(queueTaskCountConfig), + Histogram.fromConfig(poolSizeConfig)) + } + +} diff --git a/kamon-core/src/main/scala/kamon/metric/RouterMetrics.scala b/kamon-core/src/main/scala/kamon/metric/RouterMetrics.scala index 9660b6ff..ddfef416 100644 --- a/kamon-core/src/main/scala/kamon/metric/RouterMetrics.scala +++ b/kamon-core/src/main/scala/kamon/metric/RouterMetrics.scala @@ -58,19 +58,25 @@ object RouterMetrics extends MetricGroupCategory { Errors -> errors) } - val Factory = new MetricGroupFactory { - type GroupRecorder = RouterMetricsRecorder + val Factory = RouterMetricGroupFactory +} - def create(config: Config, system: ActorSystem): RouterMetricsRecorder = { - val settings = config.getConfig("precision.router") +case object RouterMetricGroupFactory extends MetricGroupFactory { - val processingTimeConfig = settings.getConfig("processing-time") - val timeInMailboxConfig = settings.getConfig("time-in-mailbox") + import RouterMetrics._ - new RouterMetricsRecorder( - Histogram.fromConfig(processingTimeConfig), - Histogram.fromConfig(timeInMailboxConfig), - Counter()) - } + type GroupRecorder = RouterMetricsRecorder + + def create(config: Config, system: ActorSystem): RouterMetricsRecorder = { + val settings = config.getConfig("precision.router") + + val processingTimeConfig = settings.getConfig("processing-time") + val timeInMailboxConfig = settings.getConfig("time-in-mailbox") + + new RouterMetricsRecorder( + Histogram.fromConfig(processingTimeConfig), + Histogram.fromConfig(timeInMailboxConfig), + Counter()) } } + diff --git a/kamon-core/src/main/scala/kamon/metric/TraceMetrics.scala b/kamon-core/src/main/scala/kamon/metric/TraceMetrics.scala index c506fe81..10dbcc01 100644 --- a/kamon-core/src/main/scala/kamon/metric/TraceMetrics.scala +++ b/kamon-core/src/main/scala/kamon/metric/TraceMetrics.scala @@ -59,19 +59,24 @@ object TraceMetrics extends MetricGroupCategory { def metrics: Map[MetricIdentity, MetricSnapshot] = segments + (ElapsedTime -> elapsedTime) } - val Factory = new MetricGroupFactory { - type GroupRecorder = TraceMetricRecorder + val Factory = TraceMetricGroupFactory - def create(config: Config, system: ActorSystem): TraceMetricRecorder = { +} - val settings = config.getConfig("precision.trace") - val elapsedTimeConfig = settings.getConfig("elapsed-time") - val segmentConfig = settings.getConfig("segment") +case object TraceMetricGroupFactory extends MetricGroupFactory { - new TraceMetricRecorder( - Histogram.fromConfig(elapsedTimeConfig, Scale.Nano), - () ⇒ Histogram.fromConfig(segmentConfig, Scale.Nano)) - } - } + import TraceMetrics._ -} + type GroupRecorder = TraceMetricRecorder + + def create(config: Config, system: ActorSystem): TraceMetricRecorder = { + + val settings = config.getConfig("precision.trace") + val elapsedTimeConfig = settings.getConfig("elapsed-time") + val segmentConfig = settings.getConfig("segment") + + new TraceMetricRecorder( + Histogram.fromConfig(elapsedTimeConfig, Scale.Nano), + () ⇒ Histogram.fromConfig(segmentConfig, Scale.Nano)) + } +}
\ No newline at end of file diff --git a/kamon-core/src/main/scala/kamon/metric/instrument/Histogram.scala b/kamon-core/src/main/scala/kamon/metric/instrument/Histogram.scala index 813a2a16..bed75fc8 100644 --- a/kamon-core/src/main/scala/kamon/metric/instrument/Histogram.scala +++ b/kamon-core/src/main/scala/kamon/metric/instrument/Histogram.scala @@ -160,7 +160,7 @@ class HdrHistogram(lowestTrackableValue: Long, highestTrackableValue: Long, sign } -class CompactHdrSnapshot(val scale: Scale, val numberOfMeasurements: Long, compactRecords: Array[Long], unitMagnitude: Int, +case class CompactHdrSnapshot(val scale: Scale, val numberOfMeasurements: Long, compactRecords: Array[Long], unitMagnitude: Int, subBucketHalfCount: Int, subBucketHalfCountMagnitude: Int) extends Histogram.Snapshot { def min: Long = if (compactRecords.length == 0) 0 else levelFromCompactRecord(compactRecords(0)) |