diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2017-05-25 16:52:52 +0200 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2017-05-25 16:52:52 +0200 |
commit | a3d78ef61a277b0b62dc93daf84756dfa7625d3d (patch) | |
tree | 4fee7ce93ecfb4e32c7aaaa22efb75ed07c667f6 /kamon-core/src/main/scala/kamon/metric/RecorderRegistry.scala | |
parent | 22379d3f318b2cd3a4c995ff1c45bda33d935a46 (diff) | |
download | Kamon-a3d78ef61a277b0b62dc93daf84756dfa7625d3d.tar.gz Kamon-a3d78ef61a277b0b62dc93daf84756dfa7625d3d.tar.bz2 Kamon-a3d78ef61a277b0b62dc93daf84756dfa7625d3d.zip |
trying to flatten out the structure and eliminate the notion of entitites
Diffstat (limited to 'kamon-core/src/main/scala/kamon/metric/RecorderRegistry.scala')
-rw-r--r-- | kamon-core/src/main/scala/kamon/metric/RecorderRegistry.scala | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/kamon-core/src/main/scala/kamon/metric/RecorderRegistry.scala b/kamon-core/src/main/scala/kamon/metric/RecorderRegistry.scala deleted file mode 100644 index fd728b1d..00000000 --- a/kamon-core/src/main/scala/kamon/metric/RecorderRegistry.scala +++ /dev/null @@ -1,61 +0,0 @@ -package kamon -package metric - -import java.util.concurrent.ScheduledThreadPoolExecutor -import java.util.concurrent.atomic.AtomicReference - -import com.typesafe.config.Config -import kamon.metric.instrument.InstrumentFactory - -import scala.collection.concurrent.TrieMap - - -trait RecorderRegistry { - def shouldTrack(entity: Entity): Boolean - def getRecorder(entity: Entity): EntityRecorder - def removeRecorder(entity: Entity): Boolean -} - -class RecorderRegistryImpl(initialConfig: Config) extends RecorderRegistry { - private val scheduler = new ScheduledThreadPoolExecutor(1, numberedThreadFactory("kamon.metric.refresh-scheduler")) - private val instrumentFactory = new AtomicReference[InstrumentFactory]() - private val entityFilter = new AtomicReference[EntityFilter]() - private val entities = TrieMap.empty[Entity, EntityRecorder with EntitySnapshotProducer] - - reconfigure(initialConfig) - - - override def shouldTrack(entity: Entity): Boolean = - entityFilter.get().accept(entity) - - override def getRecorder(entity: Entity): EntityRecorder = - entities.atomicGetOrElseUpdate(entity, new DefaultEntityRecorder(entity, instrumentFactory.get(), scheduler)) - - override def removeRecorder(entity: Entity): Boolean = - entities.remove(entity).nonEmpty - - private[kamon] def reconfigure(config: Config): Unit = synchronized { - instrumentFactory.set(InstrumentFactory.fromConfig(config)) - entityFilter.set(EntityFilter.fromConfig(config)) - - val refreshSchedulerPoolSize = config.getInt("kamon.metric.refresh-scheduler-pool-size") - scheduler.setCorePoolSize(refreshSchedulerPoolSize) - } - - private[kamon] def snapshot(): Seq[EntitySnapshot] = { - entities.values.map(_.snapshot()).toSeq - } - - //private[kamon] def diagnosticData -} - -case class RecorderRegistryDiagnostic(entities: Seq[Entity]) - - - - - - - - - |