blob: ebf4fd2b27916d9a5d9def53dd4daf2ac65d4ead (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package kamon.metric
import java.util.concurrent.TimeUnit
import com.codahale.metrics._
import akka.actor.ActorRef
object Metrics {
val registry: MetricRegistry = new MetricRegistry
val consoleReporter = ConsoleReporter.forRegistry(registry)
val newrelicReporter = NewRelicReporter(registry)
//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("")(_ + "/" + _)
}
|