aboutsummaryrefslogtreecommitdiff
path: root/kamon-akka/src/main/scala/kamon/akka/instrumentation
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2015-03-13 16:53:28 +0100
committerIvan Topolnjak <ivantopo@gmail.com>2015-03-13 16:53:28 +0100
commit3b6977edda25b98914a567f690bce9aecbb60d64 (patch)
treec38589f5b34b028734401cb7bee361e7401095e3 /kamon-akka/src/main/scala/kamon/akka/instrumentation
parent0bb77ab8d744f57d70db846d3746c5e5878e56ee (diff)
downloadKamon-3b6977edda25b98914a567f690bce9aecbb60d64.tar.gz
Kamon-3b6977edda25b98914a567f690bce9aecbb60d64.tar.bz2
Kamon-3b6977edda25b98914a567f690bce9aecbb60d64.zip
! akka: avoid catching the root supervisors with the metrics instrumentation, fixes #157.
Diffstat (limited to 'kamon-akka/src/main/scala/kamon/akka/instrumentation')
-rw-r--r--kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala8
1 files changed, 5 insertions, 3 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 39bdcfe0..deb43499 100644
--- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala
+++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala
@@ -34,16 +34,18 @@ 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 = {
- val actorEntity = Entity(system.name + "/" + ref.path.elements.mkString("/"), ActorMetrics.category)
+ def isRootSupervisor(path: String): Boolean = path.length == 0 || path == "user" || path == "system"
- if (Kamon.metrics.shouldTrack(actorEntity)) {
+ val pathString = ref.path.elements.mkString("/")
+ val actorEntity = Entity(system.name + "/" + pathString, ActorMetrics.category)
+
+ if (!isRootSupervisor(pathString) && Kamon.metrics.shouldTrack(actorEntity)) {
val actorMetricsRecorder = Kamon.metrics.entity(ActorMetrics, actorEntity)
val cellMetrics = cell.asInstanceOf[ActorCellMetrics]
cellMetrics.entity = actorEntity
cellMetrics.recorder = Some(actorMetricsRecorder)
}
-
}
@Pointcut("execution(* akka.actor.ActorCell.invoke(*)) && this(cell) && args(envelope)")