diff options
Diffstat (limited to 'src/main/scala/kamon/metric/Metrics.scala')
-rw-r--r-- | src/main/scala/kamon/metric/Metrics.scala | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/scala/kamon/metric/Metrics.scala b/src/main/scala/kamon/metric/Metrics.scala index 25c9bd8e..ebf4fd2b 100644 --- a/src/main/scala/kamon/metric/Metrics.scala +++ b/src/main/scala/kamon/metric/Metrics.scala @@ -2,6 +2,7 @@ package kamon.metric import java.util.concurrent.TimeUnit import com.codahale.metrics._ +import akka.actor.ActorRef object Metrics { val registry: MetricRegistry = new MetricRegistry @@ -9,10 +10,21 @@ object Metrics { val consoleReporter = ConsoleReporter.forRegistry(registry) val newrelicReporter = NewRelicReporter(registry) - newrelicReporter.start(5, TimeUnit.SECONDS) - //consoleReporter.build().start(5, TimeUnit.SECONDS) + //newrelicReporter.start(5, TimeUnit.SECONDS) + consoleReporter.build().start(60, TimeUnit.SECONDS) + + + def deregister(fullName: String) = { + registry.removeMatching(new MetricFilter { + def matches(name: String, metric: Metric): Boolean = name.startsWith(fullName) + }) + } } object MetricDirectory { def nameForDispatcher(actorSystem: String, dispatcher: String) = s"/ActorSystem/${actorSystem}/Dispatcher/${dispatcher}/" + + def nameForMailbox(actorSystem: String, actor: String) = s"/ActorSystem/$actorSystem/Actor/$actor/Mailbox" + + def nameForActor(actorRef: ActorRef) = actorRef.path.elements.fold("")(_ + "/" + _) } |