aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/test/scala/kamon/metric/ActorMetricsSpec.scala
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2014-08-02 17:36:26 -0300
committerIvan Topolnjak <ivantopo@gmail.com>2014-08-02 17:36:26 -0300
commite4ff86c82955961f07faa774b2591947055b8b7f (patch)
tree40759c49f68df1d9b1c7359b0f0923514d2edaff /kamon-core/src/test/scala/kamon/metric/ActorMetricsSpec.scala
parent97d299613bd725540e5279708ecfcade59dcda70 (diff)
downloadKamon-e4ff86c82955961f07faa774b2591947055b8b7f.tar.gz
Kamon-e4ff86c82955961f07faa774b2591947055b8b7f.tar.bz2
Kamon-e4ff86c82955961f07faa774b2591947055b8b7f.zip
= core: cleanup actor metrics recorder after the actor is stopped, closes #69
Diffstat (limited to 'kamon-core/src/test/scala/kamon/metric/ActorMetricsSpec.scala')
-rw-r--r--kamon-core/src/test/scala/kamon/metric/ActorMetricsSpec.scala16
1 files changed, 15 insertions, 1 deletions
diff --git a/kamon-core/src/test/scala/kamon/metric/ActorMetricsSpec.scala b/kamon-core/src/test/scala/kamon/metric/ActorMetricsSpec.scala
index a05dc344..8f5e1b9b 100644
--- a/kamon-core/src/test/scala/kamon/metric/ActorMetricsSpec.scala
+++ b/kamon-core/src/test/scala/kamon/metric/ActorMetricsSpec.scala
@@ -18,6 +18,7 @@ package kamon.metric
import java.nio.LongBuffer
import akka.instrumentation.ActorCellMetrics
+import kamon.Kamon
import kamon.metric.ActorMetricsTestActor._
import kamon.metric.instrument.Histogram.MutableRecord
import org.scalatest.{ WordSpecLike, Matchers }
@@ -38,7 +39,7 @@ class ActorMetricsSpec extends TestKitBase with WordSpecLike with Matchers with
| filters = [
| {
| actor {
- | includes = [ "user/tracked-*", "user/measuring-*", "user/clean-after-collect" ]
+ | includes = [ "user/tracked-*", "user/measuring-*", "user/clean-after-collect", "user/stop" ]
| excludes = [ "user/tracked-explicitly-excluded"]
| }
| }
@@ -152,6 +153,19 @@ class ActorMetricsSpec extends TestKitBase with WordSpecLike with Matchers with
snapshot.timeInMailbox.recordsIterator.next().count should be(1L)
snapshot.timeInMailbox.recordsIterator.next().level should be(timings.approximateTimeInMailbox +- 10.millis.toNanos)
}
+
+ "clean up the associated recorder when the actor is stopped" in new ActorMetricsFixtures {
+ val trackedActor = createTestActor("stop")
+ actorMetricsRecorderOf(trackedActor).get // force the actor to be initialized
+ Kamon(Metrics).storage.get(ActorMetrics("user/stop")) should not be empty
+
+ val deathWatcher = TestProbe()
+ deathWatcher.watch(trackedActor)
+ trackedActor ! PoisonPill
+ deathWatcher.expectTerminated(trackedActor)
+
+ Kamon(Metrics).storage.get(ActorMetrics("user/stop")) shouldBe empty
+ }
}
trait ActorMetricsFixtures {