diff options
author | Diego <diegolparra@gmail.com> | 2014-06-07 17:13:44 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2014-06-07 17:13:44 -0300 |
commit | c958d83bea124ad609503cc9055c5f33ef88b5a7 (patch) | |
tree | 69c6b02a0d0204735d5c3d5e4a837bf5d1b67e63 /kamon-core | |
parent | 859d424e0beabb14610d216b28698557e2bf6e11 (diff) | |
download | Kamon-c958d83bea124ad609503cc9055c5f33ef88b5a7.tar.gz Kamon-c958d83bea124ad609503cc9055c5f33ef88b5a7.tar.bz2 Kamon-c958d83bea124ad609503cc9055c5f33ef88b5a7.zip |
= core: remove ContinuousHdrRecorder from ActorMetrics
* in the case that we get a negative number, change the number to positive in MinMaxCounter in order to avoid IndexOutOfBoundsException.
Diffstat (limited to 'kamon-core')
3 files changed, 5 insertions, 5 deletions
diff --git a/kamon-core/src/main/scala/kamon/metrics/ActorMetrics.scala b/kamon-core/src/main/scala/kamon/metrics/ActorMetrics.scala index 44dd84b0..9e19dced 100644 --- a/kamon-core/src/main/scala/kamon/metrics/ActorMetrics.scala +++ b/kamon-core/src/main/scala/kamon/metrics/ActorMetrics.scala @@ -17,7 +17,7 @@ package kamon.metrics import com.typesafe.config.Config -import kamon.metrics.instruments.{ CounterRecorder, ContinuousHdrRecorder } +import kamon.metrics.instruments.CounterRecorder import org.HdrHistogram.HdrRecorder case class ActorMetrics(name: String) extends MetricGroupIdentity { @@ -62,7 +62,7 @@ object ActorMetrics extends MetricGroupCategory { new ActorMetricRecorder( HdrRecorder(processingTimeConfig.highestTrackableValue, processingTimeConfig.significantValueDigits, Scale.Nano), - ContinuousHdrRecorder(mailboxSizeConfig.highestTrackableValue, mailboxSizeConfig.significantValueDigits, Scale.Unit), + HdrRecorder(mailboxSizeConfig.highestTrackableValue, mailboxSizeConfig.significantValueDigits, Scale.Unit), HdrRecorder(timeInMailboxConfig.highestTrackableValue, timeInMailboxConfig.significantValueDigits, Scale.Nano), CounterRecorder()) } diff --git a/kamon-core/src/main/scala/kamon/metrics/instruments/MinMaxCounter.scala b/kamon-core/src/main/scala/kamon/metrics/instruments/MinMaxCounter.scala index 7f6c2487..d6b79ce3 100644 --- a/kamon-core/src/main/scala/kamon/metrics/instruments/MinMaxCounter.scala +++ b/kamon-core/src/main/scala/kamon/metrics/instruments/MinMaxCounter.scala @@ -40,7 +40,7 @@ class MinMaxCounter { } def collect(): CounterMeasurement = { - val currentValue = sum.get() + val currentValue = if (sum.get() < 0) 0 else sum.get() val result = CounterMeasurement(abs(min.maxThenReset()), max.maxThenReset(), currentValue) max.update(currentValue) min.update(-currentValue) diff --git a/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala b/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala index 7430e0f0..645ca96a 100644 --- a/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala +++ b/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala @@ -87,9 +87,9 @@ class ActorMetricsSpec extends TestKitBase with WordSpecLike with Matchers { // process the tick in which the actor is stalled. val stalledTickMetrics = expectActorMetrics("user/tracked-mailbox-size-queueing-up", metricsListener, 2 seconds) - stalledTickMetrics.mailboxSize.numberOfMeasurements should equal(31) + stalledTickMetrics.mailboxSize.numberOfMeasurements should equal(30) // only the automatic last-value recording should be taken, and includes the message being currently processed. - stalledTickMetrics.mailboxSize.measurements should contain only (Measurement(10, 31)) + stalledTickMetrics.mailboxSize.measurements should contain only (Measurement(10, 30)) stalledTickMetrics.mailboxSize.min should equal(10) stalledTickMetrics.mailboxSize.max should equal(10) stalledTickMetrics.processingTime.numberOfMeasurements should be(0L) |