diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2014-01-28 01:25:51 -0300 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2014-01-28 01:25:51 -0300 |
commit | 01450abea84a4c0f9f4efe73201a8ca041acea2b (patch) | |
tree | 601b76380bd5c3ba405d6b480ddd1090b574ea98 /kamon-core/src/test/scala | |
parent | b6ea0a93e6be8e1f355f1bc993618d178d0c9372 (diff) | |
download | Kamon-01450abea84a4c0f9f4efe73201a8ca041acea2b.tar.gz Kamon-01450abea84a4c0f9f4efe73201a8ca041acea2b.tar.bz2 Kamon-01450abea84a4c0f9f4efe73201a8ca041acea2b.zip |
store actor metrics in the new metrics extension
Diffstat (limited to 'kamon-core/src/test/scala')
-rw-r--r-- | kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala b/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala index 127de4c4..91fb3a69 100644 --- a/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala +++ b/kamon-core/src/test/scala/kamon/metrics/ActorMetricsSpec.scala @@ -16,36 +16,43 @@ package kamon.metrics -import org.scalatest.{ WordSpecLike, Matchers, WordSpec } +import org.scalatest.{ WordSpecLike, Matchers } import akka.testkit.TestKitBase import akka.actor.{ Actor, Props, ActorSystem } import com.typesafe.config.ConfigFactory -import kamon.Kamon -import kamon.metrics.ActorMetricsDispatcher.{ ActorMetricsSnapshot, Subscribe } import scala.concurrent.duration._ +import kamon.Kamon +import kamon.metrics.Subscriptions.TickMetricSnapshot class ActorMetricsSpec extends TestKitBase with WordSpecLike with Matchers { implicit lazy val system: ActorSystem = ActorSystem("actor-metrics-spec", ConfigFactory.parseString( """ - |kamon.metrics.actors.tracked = ["user/test*"] - """.stripMargin)) + |kamon.metrics { + | filters = [ + | { + | actor { + | includes = [ "user/*" ] + | excludes = [ ] + | } + | } + | ] + |} + """.stripMargin)) - implicit def self = testActor - - lazy val metricsExtension = Actor.noSender "the Kamon actor metrics" should { "track configured actors" in { - system.actorOf(Props[Other], "test-tracked-actor") ! "nothing" - metricsExtension ! Subscribe("user/test-tracked-actor") + Kamon(Metrics).subscribe(ActorMetrics, "user/test-tracked-actor", testActor) + + system.actorOf(Props[Discard], "test-tracked-actor") ! "nothing" - within(5 seconds) { - expectMsgType[ActorMetricsDispatcher.ActorMetricsSnapshot] - } + println(within(5 seconds) { + expectMsgType[TickMetricSnapshot] + }) } } } -class Other extends Actor { +class Discard extends Actor { def receive = { case a ⇒ } } |