diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2016-03-28 23:22:44 +0200 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2016-03-28 23:22:44 +0200 |
commit | dd20885c4a72ada4595db855d617c91db81adbf0 (patch) | |
tree | 2ccdb6598bcfbbdcc3e48f51563ea1b0bcacc3a5 /kamon-akka | |
parent | 71e777ebec4f244f5233788fd8af2e062cf14f24 (diff) | |
download | Kamon-dd20885c4a72ada4595db855d617c91db81adbf0.tar.gz Kamon-dd20885c4a72ada4595db855d617c91db81adbf0.tar.bz2 Kamon-dd20885c4a72ada4595db855d617c91db81adbf0.zip |
correctly differentiate between actors and routers, fixes #271
Diffstat (limited to 'kamon-akka')
-rw-r--r-- | kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorMonitor.scala | 10 | ||||
-rw-r--r-- | kamon-akka/src/main/scala/kamon/akka/instrumentation/CellInfo.scala | 5 |
2 files changed, 5 insertions, 10 deletions
diff --git a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorMonitor.scala b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorMonitor.scala index 6bbefc6f..191b4677 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorMonitor.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorMonitor.scala @@ -5,7 +5,7 @@ import akka.kamon.instrumentation.ActorMonitors.{ TrackedRoutee, TrackedActor } import kamon.Kamon import kamon.akka.{ RouterMetrics, ActorMetrics } import kamon.metric.Entity -import kamon.trace.{ TraceContext, EmptyTraceContext, Tracer } +import kamon.trace.{ EmptyTraceContext, Tracer } import kamon.util.RelativeNanoTimestamp import org.aspectj.lang.ProceedingJoinPoint @@ -22,7 +22,7 @@ object ActorMonitor { val cellInfo = CellInfo.cellInfoFor(cell, system, ref, parent) if (cellInfo.isRouter) - ActorMonitors.NoOp + ActorMonitors.ContextPropagationOnly else { if (cellInfo.isRoutee) createRouteeMonitor(cellInfo) @@ -49,12 +49,6 @@ object ActorMonitor { } object ActorMonitors { - val NoOp = new ActorMonitor { - override def captureEnvelopeContext(): EnvelopeContext = EnvelopeContext(RelativeNanoTimestamp.zero, EmptyTraceContext) - override def processMessage(pjp: ProceedingJoinPoint, envelopeContext: EnvelopeContext): AnyRef = pjp.proceed() - override def processFailure(failure: Throwable): Unit = {} - override def cleanup(): Unit = {} - } val ContextPropagationOnly = new ActorMonitor { def captureEnvelopeContext(): EnvelopeContext = diff --git a/kamon-akka/src/main/scala/kamon/akka/instrumentation/CellInfo.scala b/kamon-akka/src/main/scala/kamon/akka/instrumentation/CellInfo.scala index e144e605..bc06bc77 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/CellInfo.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/CellInfo.scala @@ -1,7 +1,7 @@ package akka.kamon.instrumentation import akka.actor.{ Cell, ActorRef, ActorSystem } -import akka.routing.{ RoutedActorRef, RoutedActorCell } +import akka.routing.{ NoRouter, RoutedActorRef, RoutedActorCell } import kamon.Kamon import kamon.akka.{ ActorMetrics, RouterMetrics } import kamon.metric.Entity @@ -15,10 +15,11 @@ object CellInfo { def cellInfoFor(cell: Cell, system: ActorSystem, ref: ActorRef, parent: ActorRef): CellInfo = { import kamon.metric.Entity + def hasRouterProps(cell: Cell): Boolean = cell.props.deploy.routerConfig != NoRouter val pathString = ref.path.elements.mkString("/") val isRootSupervisor = pathString.length == 0 || pathString == "user" || pathString == "system" - val isRouter = cell.isInstanceOf[RoutedActorCell] + val isRouter = hasRouterProps(cell) val isRoutee = parent.isInstanceOf[RoutedActorRef] val name = if (isRoutee) cellName(system, parent) else cellName(system, ref) |