diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2015-02-12 11:30:06 +0100 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2015-02-13 05:15:30 +0100 |
commit | c6bb65535bcc3cc1ff3834a91473ee8dfa6145e8 (patch) | |
tree | d7dbe6a1007b168998f167ac74a98744542c6fa8 /kamon-akka/src/main/scala | |
parent | 6729c9632245328a007332cdcce7d362584d735a (diff) | |
download | Kamon-c6bb65535bcc3cc1ff3834a91473ee8dfa6145e8.tar.gz Kamon-c6bb65535bcc3cc1ff3834a91473ee8dfa6145e8.tar.bz2 Kamon-c6bb65535bcc3cc1ff3834a91473ee8dfa6145e8.zip |
! all: Kamon now works as a single instance in a companion object.
Diffstat (limited to 'kamon-akka/src/main/scala')
3 files changed, 12 insertions, 10 deletions
diff --git a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala index c961737d..7c722569 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala @@ -19,8 +19,9 @@ package akka.kamon.instrumentation import akka.actor._ import akka.dispatch.{ Envelope, MessageDispatcher } import akka.routing.RoutedActorCell +import kamon.Kamon import kamon.akka.{ RouterMetrics, ActorMetrics } -import kamon.metric.{ Metrics, Entity } +import kamon.metric.Entity import kamon.trace._ import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.annotation._ @@ -33,7 +34,7 @@ class ActorCellInstrumentation { @After("actorCellCreation(cell, system, ref, props, dispatcher, parent)") def afterCreation(cell: ActorCell, system: ActorSystem, ref: ActorRef, props: Props, dispatcher: MessageDispatcher, parent: ActorRef): Unit = { - Metrics.get(system).register(ActorMetrics, ref.path.elements.mkString("/")).map { registration ⇒ + Kamon.metrics.register(ActorMetrics, ref.path.elements.mkString("/")).map { registration ⇒ val cellMetrics = cell.asInstanceOf[ActorCellMetrics] cellMetrics.entity = registration.entity @@ -89,14 +90,14 @@ class ActorCellInstrumentation { def afterStop(cell: ActorCell): Unit = { val cellMetrics = cell.asInstanceOf[ActorCellMetrics] cellMetrics.recorder.map { _ ⇒ - Metrics.get(cell.system).unregister(cellMetrics.entity) + Kamon.metrics.unregister(cellMetrics.entity) } // The Stop can't be captured from the RoutedActorCell so we need to put this piece of cleanup here. if (cell.isInstanceOf[RoutedActorCell]) { val routedCellMetrics = cell.asInstanceOf[RoutedActorCellMetrics] routedCellMetrics.routerRecorder.map { _ ⇒ - Metrics.get(cell.system).unregister(routedCellMetrics.routerEntity) + Kamon.metrics.unregister(routedCellMetrics.routerEntity) } } } @@ -123,7 +124,7 @@ class RoutedActorCellInstrumentation { @After("routedActorCellCreation(cell, system, ref, props, dispatcher, routeeProps, supervisor)") def afterRoutedActorCellCreation(cell: RoutedActorCell, system: ActorSystem, ref: ActorRef, props: Props, dispatcher: MessageDispatcher, routeeProps: Props, supervisor: ActorRef): Unit = { - Metrics.get(system).register(RouterMetrics, ref.path.elements.mkString("/")).map { registration ⇒ + Kamon.metrics.register(RouterMetrics, ref.path.elements.mkString("/")).map { registration ⇒ val cellMetrics = cell.asInstanceOf[RoutedActorCellMetrics] cellMetrics.routerEntity = registration.entity diff --git a/kamon-akka/src/main/scala/kamon/akka/instrumentation/AskPatternInstrumentation.scala b/kamon-akka/src/main/scala/kamon/akka/instrumentation/AskPatternInstrumentation.scala index 28bfcae9..e1dcdf32 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/AskPatternInstrumentation.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/AskPatternInstrumentation.scala @@ -44,7 +44,7 @@ class AskPatternInstrumentation { actor match { // the AskPattern will only work for InternalActorRef's with these conditions. case ref: InternalActorRef if !ref.isTerminated && timeout.duration.length > 0 ⇒ - val akkaExtension = ctx.lookupExtension(Akka) + val akkaExtension = Kamon.extension(Akka) val future = pjp.proceed().asInstanceOf[Future[AnyRef]] val system = ref.provider.guardian.underlying.system diff --git a/kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala b/kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala index f4bc31c4..7b15c443 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala @@ -22,8 +22,9 @@ import akka.actor.{ ActorSystem, ActorSystemImpl } import akka.dispatch.ForkJoinExecutorConfigurator.AkkaForkJoinPool import akka.dispatch._ import akka.kamon.instrumentation.LookupDataAware.LookupData +import kamon.Kamon import kamon.akka.{ AkkaDispatcherMetrics, ThreadPoolExecutorDispatcherMetrics, ForkJoinPoolDispatcherMetrics } -import kamon.metric.{ Metrics, Entity } +import kamon.metric.Entity import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.annotation._ @@ -58,10 +59,10 @@ class DispatcherInstrumentation { private def registerDispatcher(dispatcherName: String, executorService: ExecutorService, system: ActorSystem): Unit = executorService match { case fjp: AkkaForkJoinPool ⇒ - Metrics.get(system).register(ForkJoinPoolDispatcherMetrics.factory(fjp), dispatcherName) + Kamon.metrics.register(ForkJoinPoolDispatcherMetrics.factory(fjp), dispatcherName) case tpe: ThreadPoolExecutor ⇒ - Metrics.get(system).register(ThreadPoolExecutorDispatcherMetrics.factory(tpe), dispatcherName) + Kamon.metrics.register(ThreadPoolExecutorDispatcherMetrics.factory(tpe), dispatcherName) case others ⇒ // Currently not interested in other kinds of dispatchers. } @@ -119,7 +120,7 @@ class DispatcherInstrumentation { import lazyExecutor.lookupData if (lookupData.actorSystem != null) - Metrics.get(lookupData.actorSystem).unregister(Entity(lookupData.dispatcherName, AkkaDispatcherMetrics.Category)) + Kamon.metrics.unregister(Entity(lookupData.dispatcherName, AkkaDispatcherMetrics.Category)) } } |