diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2015-07-29 19:19:41 +0200 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2015-07-29 19:19:41 +0200 |
commit | 2a51ba02383eaf31037935b466468fc2da8319b7 (patch) | |
tree | 013f64843c3b4a6c3c3ad7f1a03100c3bfea4593 /kamon-akka/src/main/scala/kamon/akka | |
parent | ca1c1e93b1ced1ae24f2a072cb8cabc59971d6fa (diff) | |
download | Kamon-2a51ba02383eaf31037935b466468fc2da8319b7.tar.gz Kamon-2a51ba02383eaf31037935b466468fc2da8319b7.tar.bz2 Kamon-2a51ba02383eaf31037935b466468fc2da8319b7.zip |
= akka: correctly set LookupData for routers used by BalancingPool, fixes #199.
Diffstat (limited to 'kamon-akka/src/main/scala/kamon/akka')
-rw-r--r-- | kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala | 14 |
1 files changed, 13 insertions, 1 deletions
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 0b963c16..e90838ad 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala @@ -18,7 +18,7 @@ package akka.kamon.instrumentation import java.util.concurrent.{ ExecutorService, ThreadPoolExecutor } -import akka.actor.{ ActorSystem, ActorSystemImpl } +import akka.actor.{ ActorContext, Props, ActorSystem, ActorSystemImpl } import akka.dispatch.ForkJoinExecutorConfigurator.AkkaForkJoinPool import akka.dispatch._ import akka.kamon.instrumentation.LookupDataAware.LookupData @@ -139,6 +139,18 @@ class DispatcherInstrumentation { } } + @Pointcut("execution(* akka.routing.BalancingPool.newRoutee(..)) && args(props, context)") + def createNewRouteeOnBalancingPool(props: Props, context: ActorContext): Unit = {} + + @Around("createNewRouteeOnBalancingPool(props, context)") + def aroundCreateNewRouteeOnBalancingPool(pjp: ProceedingJoinPoint, props: Props, context: ActorContext): Any = { + val deployPath = context.self.path.elements.drop(1).mkString("/", "/", "") + val dispatcherId = s"BalancingPool-$deployPath" + + LookupDataAware.withLookupData(LookupData(dispatcherId, context.system)) { + pjp.proceed() + } + } } @Aspect |