aboutsummaryrefslogtreecommitdiff
path: root/kamon-akka
diff options
context:
space:
mode:
Diffstat (limited to 'kamon-akka')
-rw-r--r--kamon-akka/src/main/resources/reference.conf2
-rw-r--r--kamon-akka/src/main/scala/kamon/akka/instrumentation/ActorCellInstrumentation.scala8
-rw-r--r--kamon-akka/src/test/scala/kamon/akka/ActorMetricsSpec.scala6
3 files changed, 11 insertions, 5 deletions
diff --git a/kamon-akka/src/main/resources/reference.conf b/kamon-akka/src/main/resources/reference.conf
index 47ce073b..c1e59e63 100644
--- a/kamon-akka/src/main/resources/reference.conf
+++ b/kamon-akka/src/main/resources/reference.conf
@@ -17,7 +17,7 @@ kamon {
metric.filters {
akka-actor {
includes = []
- excludes = [ "", "*/user", "*/system**", "*/user/IO-**" ]
+ excludes = [ "*/system/**", "*/user/IO-**" ]
}
akka-router {
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)")
diff --git a/kamon-akka/src/test/scala/kamon/akka/ActorMetricsSpec.scala b/kamon-akka/src/test/scala/kamon/akka/ActorMetricsSpec.scala
index cef0071b..4647abc0 100644
--- a/kamon-akka/src/test/scala/kamon/akka/ActorMetricsSpec.scala
+++ b/kamon-akka/src/test/scala/kamon/akka/ActorMetricsSpec.scala
@@ -38,7 +38,7 @@ class ActorMetricsSpec extends BaseKamonSpec("actor-metrics-spec") {
|
| filters {
| akka-actor {
- | includes = [ "*/user/tracked-*", "*/user/measuring-*", "*/user/clean-after-collect", "*/user/stop" ]
+ | includes = [ "*/user/tracked-*", "*/user/measuring-*", "*/user/clean-after-collect", "*/user/stop", "*/" ]
| excludes = [ "*/user/tracked-explicitly-excluded", "*/user/non-tracked-actor" ]
| }
| }
@@ -64,6 +64,10 @@ class ActorMetricsSpec extends BaseKamonSpec("actor-metrics-spec") {
actorMetricsRecorderOf(trackedButExplicitlyExcluded) shouldBe empty
}
+ "not pick up the root supervisor" in {
+ Kamon.metrics.find("actor-metrics-spec/", ActorMetrics.category) shouldBe empty
+ }
+
"reset all recording instruments after taking a snapshot" in new ActorMetricsFixtures {
val trackedActor = createTestActor("clean-after-collect")