aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2014-03-24 00:39:31 -0300
committerIvan Topolnjak <ivantopo@gmail.com>2014-03-24 00:39:31 -0300
commitc941dd2b2556d3046f308d2995049dd35e84b3e3 (patch)
tree033d94ba08a34df6d9dab202a8662fa00aa7ce57 /kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala
parentfa0fb9e7d3d0181866b95106374b2ab62ba88a2d (diff)
downloadKamon-c941dd2b2556d3046f308d2995049dd35e84b3e3.tar.gz
Kamon-c941dd2b2556d3046f308d2995049dd35e84b3e3.tar.bz2
Kamon-c941dd2b2556d3046f308d2995049dd35e84b3e3.zip
add assertions for time-in-mailbox and processing-time
Diffstat (limited to 'kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala')
-rw-r--r--kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala18
1 files changed, 14 insertions, 4 deletions
diff --git a/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala b/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala
index 646e4159..d06cbb8b 100644
--- a/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala
+++ b/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala
@@ -89,10 +89,20 @@ class ActorMetricsSpec extends TestKitBase with WordSpecLike with Matchers {
// let the first snapshot pass
metricsListener.expectMsgType[TickMetricSnapshot]
- val actorMetrics = expectActorMetrics("user/tracked-mailbox-size-queueing-up", metricsListener, 3 seconds)
- actorMetrics.mailboxSize.numberOfMeasurements should equal(1)
- actorMetrics.mailboxSize.measurements should contain only (Measurement(9, 1)) // only the automatic last-value recording
- actorMetrics.mailboxSize.max should equal(9)
+ // 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(1)
+ stalledTickMetrics.mailboxSize.measurements should contain only (Measurement(9, 1)) // only the automatic last-value recording
+ stalledTickMetrics.mailboxSize.max should equal(9)
+ stalledTickMetrics.processingTime.numberOfMeasurements should be(0L)
+ stalledTickMetrics.timeInMailbox.numberOfMeasurements should be(0L)
+
+ // process the tick after the actor is unblocked.
+ val afterStallTickMetrics = expectActorMetrics("user/tracked-mailbox-size-queueing-up", metricsListener, 2 seconds)
+ afterStallTickMetrics.processingTime.numberOfMeasurements should be(10L)
+ afterStallTickMetrics.timeInMailbox.numberOfMeasurements should be(10L)
+ afterStallTickMetrics.processingTime.max should be(2500.milliseconds.toNanos +- 100.milliseconds.toNanos)
+ afterStallTickMetrics.timeInMailbox.max should be(2500.milliseconds.toNanos +- 100.milliseconds.toNanos)
}
}