From d1e22b3f446c89413c67421f19ab5215ebdfcd43 Mon Sep 17 00:00:00 2001 From: Ivan Topolnak Date: Mon, 24 Jun 2013 19:16:22 -0300 Subject: doing some testing on alternatives ways to weave the classes --- src/main/scala/kamon/metric/Metrics.scala | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/main/scala/kamon/metric/Metrics.scala') diff --git a/src/main/scala/kamon/metric/Metrics.scala b/src/main/scala/kamon/metric/Metrics.scala index 30b8bda9..46fb2b64 100644 --- a/src/main/scala/kamon/metric/Metrics.scala +++ b/src/main/scala/kamon/metric/Metrics.scala @@ -14,11 +14,11 @@ trait MetricDepot { object Metrics extends MetricDepot { val registry: MetricRegistry = new MetricRegistry - val consoleReporter = ConsoleReporter.forRegistry(registry) + val consoleReporter = ConsoleReporter.forRegistry(registry).convertDurationsTo(TimeUnit.NANOSECONDS) val newrelicReporter = NewRelicReporter(registry) //newrelicReporter.start(5, TimeUnit.SECONDS) - consoleReporter.build().start(60, TimeUnit.SECONDS) + consoleReporter.build().start(10, TimeUnit.SECONDS) def include(name: String, metric: Metric) = registry.register(name, metric) @@ -43,5 +43,18 @@ object MetricDirectory { def nameForMailbox(actorSystem: String, actor: String) = s"/ActorSystem/$actorSystem/Actor/$actor/Mailbox" - def nameForActor(actorRef: ActorRef) = actorRef.path.elements.fold("")(_ + "/" + _) + def nameForActor(actorRef: ActorRef) = actorRef.path.elements.mkString("/") + + def shouldInstrument(actorSystem: String): Boolean = !actorSystem.startsWith("kamon") + + + def shouldInstrumentActor(actorPath: String): Boolean = { + !(actorPath.isEmpty || actorPath.startsWith("system")) + } + + + + } + + -- cgit v1.2.3