diff options
author | Diego <diegolparra@gmail.com> | 2015-08-20 00:03:16 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2015-08-25 10:13:22 -0300 |
commit | de676d611103c8b5f49514a097b51c30b555e314 (patch) | |
tree | ca31f2caf4d5cb1a1b9108b5fa99b5cede312d51 /kamon-akka/src/main | |
parent | 3f0eaed8f0ac62057a9f515c62540f237cfd6c6e (diff) | |
download | Kamon-de676d611103c8b5f49514a097b51c30b555e314.tar.gz Kamon-de676d611103c8b5f49514a097b51c30b555e314.tar.bz2 Kamon-de676d611103c8b5f49514a097b51c30b555e314.zip |
! core: generalize ThreadPoolExecutors metrics
Diffstat (limited to 'kamon-akka/src/main')
-rw-r--r-- | kamon-akka/src/main/scala/kamon/akka/DispatcherMetrics.scala | 42 | ||||
-rw-r--r-- | kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala | 13 |
2 files changed, 9 insertions, 46 deletions
diff --git a/kamon-akka/src/main/scala/kamon/akka/DispatcherMetrics.scala b/kamon-akka/src/main/scala/kamon/akka/DispatcherMetrics.scala deleted file mode 100644 index 91cbdee9..00000000 --- a/kamon-akka/src/main/scala/kamon/akka/DispatcherMetrics.scala +++ /dev/null @@ -1,42 +0,0 @@ -/* - * ========================================================================================= - * Copyright © 2013-2015 the kamon project <http://kamon.io/> - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - * ========================================================================================= - */ - -package kamon.akka - -import java.util.concurrent.ThreadPoolExecutor - -import _root_.akka.dispatch.ForkJoinExecutorConfigurator.AkkaForkJoinPool -import kamon.metric._ -import kamon.metric.instrument.InstrumentFactory -import kamon.util.executors.{ ForkJoinPoolMetrics, ThreadPoolExecutorMetrics } - -object ForkJoinPoolDispatcherMetrics { - def factory(fjp: AkkaForkJoinPool) = new EntityRecorderFactory[ForkJoinPoolMetrics] { - def category: String = AkkaDispatcherMetrics.Category - def createRecorder(instrumentFactory: InstrumentFactory) = new ForkJoinPoolMetrics(fjp, instrumentFactory) - } -} - -object ThreadPoolExecutorDispatcherMetrics { - def factory(tpe: ThreadPoolExecutor) = new EntityRecorderFactory[ThreadPoolExecutorMetrics] { - def category: String = AkkaDispatcherMetrics.Category - def createRecorder(instrumentFactory: InstrumentFactory) = new ThreadPoolExecutorMetrics(tpe, instrumentFactory) - } -} - -object AkkaDispatcherMetrics { - val Category = "akka-dispatcher" -} 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 e90838ad..0949df47 100644 --- a/kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/DispatcherInstrumentation.scala @@ -23,7 +23,8 @@ import akka.dispatch.ForkJoinExecutorConfigurator.AkkaForkJoinPool import akka.dispatch._ import akka.kamon.instrumentation.LookupDataAware.LookupData import kamon.Kamon -import kamon.akka.{ AkkaDispatcherMetrics, ThreadPoolExecutorDispatcherMetrics, ForkJoinPoolDispatcherMetrics } +import kamon.util.executors.{ ForkJoinPoolMetrics, ThreadPoolExecutorMetrics } + import kamon.metric.{ MetricsModule, Entity } import org.aspectj.lang.ProceedingJoinPoint import org.aspectj.lang.annotation._ @@ -62,13 +63,13 @@ class DispatcherInstrumentation { val dispatcherEntity = Entity(system.name + "/" + dispatcherName, AkkaDispatcherMetrics.Category, tags = Map("dispatcher-type" -> "fork-join-pool")) if (Kamon.metrics.shouldTrack(dispatcherEntity)) - Kamon.metrics.entity(ForkJoinPoolDispatcherMetrics.factory(fjp), dispatcherEntity) + Kamon.metrics.entity(ForkJoinPoolMetrics.factory(fjp, AkkaDispatcherMetrics.Category), dispatcherEntity) case tpe: ThreadPoolExecutor ⇒ val dispatcherEntity = Entity(system.name + "/" + dispatcherName, AkkaDispatcherMetrics.Category, tags = Map("dispatcher-type" -> "thread-pool-executor")) if (Kamon.metrics.shouldTrack(dispatcherEntity)) - Kamon.metrics.entity(ThreadPoolExecutorDispatcherMetrics.factory(tpe), dispatcherEntity) + Kamon.metrics.entity(ThreadPoolExecutorMetrics.factory(tpe, AkkaDispatcherMetrics.Category), dispatcherEntity) case others ⇒ // Currently not interested in other kinds of dispatchers. } @@ -194,4 +195,8 @@ object LookupDataAware { result } -}
\ No newline at end of file +} + +object AkkaDispatcherMetrics { + val Category = "akka-dispatcher" +} |