diff options
Diffstat (limited to 'kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala')
-rw-r--r-- | kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala | 12 |
1 files changed, 9 insertions, 3 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 7b15c443..eb6b5293 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala @@ -59,10 +59,16 @@ class DispatcherInstrumentation { private def registerDispatcher(dispatcherName: String, executorService: ExecutorService, system: ActorSystem): Unit = executorService match { case fjp: AkkaForkJoinPool ⇒ - Kamon.metrics.register(ForkJoinPoolDispatcherMetrics.factory(fjp), dispatcherName) + val dispatcherEntity = Entity(dispatcherName, AkkaDispatcherMetrics.Category) + + if (Kamon.metrics.shouldTrack(dispatcherEntity)) + Kamon.metrics.entity(ForkJoinPoolDispatcherMetrics.factory(fjp), dispatcherName) case tpe: ThreadPoolExecutor ⇒ - Kamon.metrics.register(ThreadPoolExecutorDispatcherMetrics.factory(tpe), dispatcherName) + val dispatcherEntity = Entity(dispatcherName, AkkaDispatcherMetrics.Category) + + if (Kamon.metrics.shouldTrack(dispatcherEntity)) + Kamon.metrics.entity(ThreadPoolExecutorDispatcherMetrics.factory(tpe), dispatcherName) case others ⇒ // Currently not interested in other kinds of dispatchers. } @@ -120,7 +126,7 @@ class DispatcherInstrumentation { import lazyExecutor.lookupData if (lookupData.actorSystem != null) - Kamon.metrics.unregister(Entity(lookupData.dispatcherName, AkkaDispatcherMetrics.Category)) + Kamon.metrics.removeEntity(Entity(lookupData.dispatcherName, AkkaDispatcherMetrics.Category)) } } |