From 8cd862debfbfa6d92473d601880cbd7c088601a1 Mon Sep 17 00:00:00 2001 From: Ivan Topolnjak Date: Sun, 15 Feb 2015 10:46:36 +0100 Subject: ! core: drop the Extension postfix on all core components. --- .../src/main/scala/kamon/metric/Metrics.scala | 141 +++++++++++++++++++++ .../main/scala/kamon/metric/MetricsExtension.scala | 141 --------------------- .../kamon/metric/MetricsExtensionSettings.scala | 117 ----------------- .../main/scala/kamon/metric/MetricsSettings.scala | 116 +++++++++++++++++ .../main/scala/kamon/metric/SimpleMetrics.scala | 10 +- .../kamon/metric/SubscriptionsDispatcher.scala | 4 +- 6 files changed, 264 insertions(+), 265 deletions(-) create mode 100644 kamon-core/src/main/scala/kamon/metric/Metrics.scala delete mode 100644 kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala delete mode 100644 kamon-core/src/main/scala/kamon/metric/MetricsExtensionSettings.scala create mode 100644 kamon-core/src/main/scala/kamon/metric/MetricsSettings.scala (limited to 'kamon-core/src/main/scala/kamon/metric') diff --git a/kamon-core/src/main/scala/kamon/metric/Metrics.scala b/kamon-core/src/main/scala/kamon/metric/Metrics.scala new file mode 100644 index 00000000..d79b1de3 --- /dev/null +++ b/kamon-core/src/main/scala/kamon/metric/Metrics.scala @@ -0,0 +1,141 @@ +/* + * ========================================================================================= + * Copyright © 2013 the kamon project + * + * 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.metric + +import com.typesafe.config.Config +import kamon.metric.SubscriptionsDispatcher.{ Unsubscribe, Subscribe } +import kamon.metric.instrument.{ DefaultRefreshScheduler, InstrumentFactory, CollectionContext } + +import scala.collection.concurrent.TrieMap +import akka.actor._ +import kamon.util.{ LazyActorRef, TriemapAtomicGetOrElseUpdate } + +case class EntityRegistration[T <: EntityRecorder](entity: Entity, recorder: T) + +trait Metrics { + def settings: MetricsSettings + def shouldTrack(entity: Entity): Boolean + def shouldTrack(entityName: String, category: String): Boolean = + shouldTrack(Entity(entityName, category)) + + def register[T <: EntityRecorder](recorderFactory: EntityRecorderFactory[T], entityName: String): Option[EntityRegistration[T]] + def register[T <: EntityRecorder](entity: Entity, recorder: T): EntityRegistration[T] + def unregister(entity: Entity): Unit + + def find(entity: Entity): Option[EntityRecorder] + def find(name: String, category: String): Option[EntityRecorder] + + def subscribe(filter: SubscriptionFilter, subscriber: ActorRef): Unit = + subscribe(filter, subscriber, permanently = false) + + def subscribe(category: String, selection: String, subscriber: ActorRef, permanently: Boolean): Unit = + subscribe(SubscriptionFilter(category, selection), subscriber, permanently) + + def subscribe(category: String, selection: String, subscriber: ActorRef): Unit = + subscribe(SubscriptionFilter(category, selection), subscriber, permanently = false) + + def subscribe(filter: SubscriptionFilter, subscriber: ActorRef, permanently: Boolean): Unit + + def unsubscribe(subscriber: ActorRef): Unit + def buildDefaultCollectionContext: CollectionContext + def instrumentFactory(category: String): InstrumentFactory +} + +private[kamon] class MetricsImpl(config: Config) extends Metrics { + private val _trackedEntities = TrieMap.empty[Entity, EntityRecorder] + private val _subscriptions = new LazyActorRef + + val settings = MetricsSettings(config) + + def shouldTrack(entity: Entity): Boolean = + settings.entityFilters.get(entity.category).map { + filter ⇒ filter.accept(entity.name) + + } getOrElse (settings.trackUnmatchedEntities) + + def register[T <: EntityRecorder](recorderFactory: EntityRecorderFactory[T], entityName: String): Option[EntityRegistration[T]] = { + import TriemapAtomicGetOrElseUpdate.Syntax + val entity = Entity(entityName, recorderFactory.category) + + if (shouldTrack(entity)) { + val instrumentFactory = settings.instrumentFactories.get(recorderFactory.category).getOrElse(settings.defaultInstrumentFactory) + val recorder = _trackedEntities.atomicGetOrElseUpdate(entity, recorderFactory.createRecorder(instrumentFactory), _.cleanup).asInstanceOf[T] + + Some(EntityRegistration(entity, recorder)) + } else None + } + + def register[T <: EntityRecorder](entity: Entity, recorder: T): EntityRegistration[T] = { + _trackedEntities.put(entity, recorder).map { oldRecorder ⇒ + oldRecorder.cleanup + } + + EntityRegistration(entity, recorder) + } + + def unregister(entity: Entity): Unit = + _trackedEntities.remove(entity).map(_.cleanup) + + def find(entity: Entity): Option[EntityRecorder] = + _trackedEntities.get(entity) + + def find(name: String, category: String): Option[EntityRecorder] = + find(Entity(name, category)) + + def subscribe(filter: SubscriptionFilter, subscriber: ActorRef, permanent: Boolean): Unit = + _subscriptions.tell(Subscribe(filter, subscriber, permanent)) + + def unsubscribe(subscriber: ActorRef): Unit = + _subscriptions.tell(Unsubscribe(subscriber)) + + def buildDefaultCollectionContext: CollectionContext = + CollectionContext(settings.defaultCollectionContextBufferSize) + + def instrumentFactory(category: String): InstrumentFactory = + settings.instrumentFactories.getOrElse(category, settings.defaultInstrumentFactory) + + private[kamon] def collectSnapshots(collectionContext: CollectionContext): Map[Entity, EntitySnapshot] = { + val builder = Map.newBuilder[Entity, EntitySnapshot] + _trackedEntities.foreach { + case (identity, recorder) ⇒ builder += ((identity, recorder.collect(collectionContext))) + } + + builder.result() + } + + /** + * Metrics Extension initialization. + */ + private var _system: ActorSystem = null + private lazy val _start = { + _subscriptions.point(_system.actorOf(SubscriptionsDispatcher.props(settings.tickInterval, this), "metrics")) + settings.pointScheduler(DefaultRefreshScheduler(_system.scheduler, _system.dispatcher)) + } + + def start(system: ActorSystem): Unit = synchronized { + _system = system + _start + _system = null + } +} + +private[kamon] object MetricsImpl { + + def apply(config: Config) = + new MetricsImpl(config) +} + diff --git a/kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala b/kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala deleted file mode 100644 index 87911352..00000000 --- a/kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala +++ /dev/null @@ -1,141 +0,0 @@ -/* - * ========================================================================================= - * Copyright © 2013 the kamon project - * - * 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.metric - -import com.typesafe.config.Config -import kamon.metric.SubscriptionsDispatcher.{ Unsubscribe, Subscribe } -import kamon.metric.instrument.{ DefaultRefreshScheduler, InstrumentFactory, CollectionContext } - -import scala.collection.concurrent.TrieMap -import akka.actor._ -import kamon.util.{ LazyActorRef, TriemapAtomicGetOrElseUpdate } - -case class EntityRegistration[T <: EntityRecorder](entity: Entity, recorder: T) - -trait MetricsExtension { - def settings: MetricsExtensionSettings - def shouldTrack(entity: Entity): Boolean - def shouldTrack(entityName: String, category: String): Boolean = - shouldTrack(Entity(entityName, category)) - - def register[T <: EntityRecorder](recorderFactory: EntityRecorderFactory[T], entityName: String): Option[EntityRegistration[T]] - def register[T <: EntityRecorder](entity: Entity, recorder: T): EntityRegistration[T] - def unregister(entity: Entity): Unit - - def find(entity: Entity): Option[EntityRecorder] - def find(name: String, category: String): Option[EntityRecorder] - - def subscribe(filter: SubscriptionFilter, subscriber: ActorRef): Unit = - subscribe(filter, subscriber, permanently = false) - - def subscribe(category: String, selection: String, subscriber: ActorRef, permanently: Boolean): Unit = - subscribe(SubscriptionFilter(category, selection), subscriber, permanently) - - def subscribe(category: String, selection: String, subscriber: ActorRef): Unit = - subscribe(SubscriptionFilter(category, selection), subscriber, permanently = false) - - def subscribe(filter: SubscriptionFilter, subscriber: ActorRef, permanently: Boolean): Unit - - def unsubscribe(subscriber: ActorRef): Unit - def buildDefaultCollectionContext: CollectionContext - def instrumentFactory(category: String): InstrumentFactory -} - -private[kamon] class MetricsExtensionImpl(config: Config) extends MetricsExtension { - private val _trackedEntities = TrieMap.empty[Entity, EntityRecorder] - private val _subscriptions = new LazyActorRef - - val settings = MetricsExtensionSettings(config) - - def shouldTrack(entity: Entity): Boolean = - settings.entityFilters.get(entity.category).map { - filter ⇒ filter.accept(entity.name) - - } getOrElse (settings.trackUnmatchedEntities) - - def register[T <: EntityRecorder](recorderFactory: EntityRecorderFactory[T], entityName: String): Option[EntityRegistration[T]] = { - import TriemapAtomicGetOrElseUpdate.Syntax - val entity = Entity(entityName, recorderFactory.category) - - if (shouldTrack(entity)) { - val instrumentFactory = settings.instrumentFactories.get(recorderFactory.category).getOrElse(settings.defaultInstrumentFactory) - val recorder = _trackedEntities.atomicGetOrElseUpdate(entity, recorderFactory.createRecorder(instrumentFactory), _.cleanup).asInstanceOf[T] - - Some(EntityRegistration(entity, recorder)) - } else None - } - - def register[T <: EntityRecorder](entity: Entity, recorder: T): EntityRegistration[T] = { - _trackedEntities.put(entity, recorder).map { oldRecorder ⇒ - oldRecorder.cleanup - } - - EntityRegistration(entity, recorder) - } - - def unregister(entity: Entity): Unit = - _trackedEntities.remove(entity).map(_.cleanup) - - def find(entity: Entity): Option[EntityRecorder] = - _trackedEntities.get(entity) - - def find(name: String, category: String): Option[EntityRecorder] = - find(Entity(name, category)) - - def subscribe(filter: SubscriptionFilter, subscriber: ActorRef, permanent: Boolean): Unit = - _subscriptions.tell(Subscribe(filter, subscriber, permanent)) - - def unsubscribe(subscriber: ActorRef): Unit = - _subscriptions.tell(Unsubscribe(subscriber)) - - def buildDefaultCollectionContext: CollectionContext = - CollectionContext(settings.defaultCollectionContextBufferSize) - - def instrumentFactory(category: String): InstrumentFactory = - settings.instrumentFactories.getOrElse(category, settings.defaultInstrumentFactory) - - private[kamon] def collectSnapshots(collectionContext: CollectionContext): Map[Entity, EntitySnapshot] = { - val builder = Map.newBuilder[Entity, EntitySnapshot] - _trackedEntities.foreach { - case (identity, recorder) ⇒ builder += ((identity, recorder.collect(collectionContext))) - } - - builder.result() - } - - /** - * Metrics Extension initialization. - */ - private var _system: ActorSystem = null - private lazy val _start = { - _subscriptions.point(_system.actorOf(SubscriptionsDispatcher.props(settings.tickInterval, this), "metrics")) - settings.pointScheduler(DefaultRefreshScheduler(_system.scheduler, _system.dispatcher)) - } - - def start(system: ActorSystem): Unit = synchronized { - _system = system - _start - _system = null - } -} - -private[kamon] object MetricsExtensionImpl { - - def apply(config: Config) = - new MetricsExtensionImpl(config) -} - diff --git a/kamon-core/src/main/scala/kamon/metric/MetricsExtensionSettings.scala b/kamon-core/src/main/scala/kamon/metric/MetricsExtensionSettings.scala deleted file mode 100644 index 9881ed00..00000000 --- a/kamon-core/src/main/scala/kamon/metric/MetricsExtensionSettings.scala +++ /dev/null @@ -1,117 +0,0 @@ -/* - * ========================================================================================= - * Copyright © 2013-2015 the kamon project - * - * 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.metric - -import com.typesafe.config.Config -import kamon.metric.instrument._ -import kamon.util.GlobPathFilter - -import scala.concurrent.duration.FiniteDuration - -/** - * Configuration settings for the Metrics extension, as read from the `kamon.metric` configuration key. - */ -case class MetricsExtensionSettings( - tickInterval: FiniteDuration, - defaultCollectionContextBufferSize: Int, - trackUnmatchedEntities: Boolean, - entityFilters: Map[String, EntityFilter], - instrumentFactories: Map[String, InstrumentFactory], - defaultInstrumentFactory: InstrumentFactory, - refreshScheduler: RefreshScheduler) { - - private[kamon] def pointScheduler(targetScheduler: RefreshScheduler): Unit = refreshScheduler match { - case lrs: LazyRefreshScheduler ⇒ lrs.point(targetScheduler) - case others ⇒ - } -} - -/** - * - */ -case class EntityFilter(includes: List[GlobPathFilter], excludes: List[GlobPathFilter]) { - def accept(name: String): Boolean = - includes.exists(_.accept(name)) && !excludes.exists(_.accept(name)) -} - -object MetricsExtensionSettings { - import kamon.util.ConfigTools.Syntax - import scala.concurrent.duration._ - - def apply(config: Config): MetricsExtensionSettings = { - val metricConfig = config.getConfig("kamon.metric") - - val tickInterval = metricConfig.getFiniteDuration("tick-interval") - val collectBufferSize = metricConfig.getInt("default-collection-context-buffer-size") - val trackUnmatchedEntities = metricConfig.getBoolean("track-unmatched-entities") - val entityFilters = loadFilters(metricConfig.getConfig("filters")) - val defaultInstrumentSettings = DefaultInstrumentSettings.fromConfig(metricConfig.getConfig("default-instrument-settings")) - - val refreshScheduler = new LazyRefreshScheduler - val instrumentFactories = loadInstrumentFactories(metricConfig.getConfig("instrument-settings"), defaultInstrumentSettings, refreshScheduler) - val defaultInstrumentFactory = new InstrumentFactory(Map.empty, defaultInstrumentSettings, refreshScheduler) - - MetricsExtensionSettings(tickInterval, collectBufferSize, trackUnmatchedEntities, entityFilters, instrumentFactories, - defaultInstrumentFactory, refreshScheduler) - } - - /** - * Load all the default filters configured under the `kamon.metric.filters` configuration key. All filters are - * defined with the entity category as a sub-key of the `kamon.metric.filters` key and two sub-keys to it: includes - * and excludes with lists of string glob patterns as values. Example: - * - * {{{ - * - * kamon.metrics.filters { - * actor { - * includes = ["user/test-actor", "user/service/worker-*"] - * excludes = ["user/IO-*"] - * } - * } - * - * }}} - * - * @return a Map from category name to corresponding entity filter. - */ - def loadFilters(filtersConfig: Config): Map[String, EntityFilter] = { - import scala.collection.JavaConverters._ - - filtersConfig.firstLevelKeys map { category: String ⇒ - val includes = filtersConfig.getStringList(s"$category.includes").asScala.map(inc ⇒ new GlobPathFilter(inc)).toList - val excludes = filtersConfig.getStringList(s"$category.excludes").asScala.map(exc ⇒ new GlobPathFilter(exc)).toList - - (category, EntityFilter(includes, excludes)) - } toMap - } - - /** - * Load any custom configuration settings defined under the `kamon.metric.instrument-settings` configuration key and - * create InstrumentFactories for them. - * - * @return a Map from category name to InstrumentFactory. - */ - def loadInstrumentFactories(instrumentSettings: Config, defaults: DefaultInstrumentSettings, refreshScheduler: RefreshScheduler): Map[String, InstrumentFactory] = { - instrumentSettings.firstLevelKeys.map { category ⇒ - val categoryConfig = instrumentSettings.getConfig(category) - val customSettings = categoryConfig.firstLevelKeys.map { instrumentName ⇒ - (instrumentName, InstrumentCustomSettings.fromConfig(categoryConfig.getConfig(instrumentName))) - } toMap - - (category, new InstrumentFactory(customSettings, defaults, refreshScheduler)) - } toMap - } -} diff --git a/kamon-core/src/main/scala/kamon/metric/MetricsSettings.scala b/kamon-core/src/main/scala/kamon/metric/MetricsSettings.scala new file mode 100644 index 00000000..a472a89b --- /dev/null +++ b/kamon-core/src/main/scala/kamon/metric/MetricsSettings.scala @@ -0,0 +1,116 @@ +/* + * ========================================================================================= + * Copyright © 2013-2015 the kamon project + * + * 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.metric + +import com.typesafe.config.Config +import kamon.metric.instrument._ +import kamon.util.GlobPathFilter + +import scala.concurrent.duration.FiniteDuration + +/** + * Configuration settings for the Metrics extension, as read from the `kamon.metric` configuration key. + */ +case class MetricsSettings( + tickInterval: FiniteDuration, + defaultCollectionContextBufferSize: Int, + trackUnmatchedEntities: Boolean, + entityFilters: Map[String, EntityFilter], + instrumentFactories: Map[String, InstrumentFactory], + defaultInstrumentFactory: InstrumentFactory, + refreshScheduler: RefreshScheduler) { + + private[kamon] def pointScheduler(targetScheduler: RefreshScheduler): Unit = refreshScheduler match { + case lrs: LazyRefreshScheduler ⇒ lrs.point(targetScheduler) + case others ⇒ + } +} + +/** + * + */ +case class EntityFilter(includes: List[GlobPathFilter], excludes: List[GlobPathFilter]) { + def accept(name: String): Boolean = + includes.exists(_.accept(name)) && !excludes.exists(_.accept(name)) +} + +object MetricsSettings { + import kamon.util.ConfigTools.Syntax + + def apply(config: Config): MetricsSettings = { + val metricConfig = config.getConfig("kamon.metric") + + val tickInterval = metricConfig.getFiniteDuration("tick-interval") + val collectBufferSize = metricConfig.getInt("default-collection-context-buffer-size") + val trackUnmatchedEntities = metricConfig.getBoolean("track-unmatched-entities") + val entityFilters = loadFilters(metricConfig.getConfig("filters")) + val defaultInstrumentSettings = DefaultInstrumentSettings.fromConfig(metricConfig.getConfig("default-instrument-settings")) + + val refreshScheduler = new LazyRefreshScheduler + val instrumentFactories = loadInstrumentFactories(metricConfig.getConfig("instrument-settings"), defaultInstrumentSettings, refreshScheduler) + val defaultInstrumentFactory = new InstrumentFactory(Map.empty, defaultInstrumentSettings, refreshScheduler) + + MetricsSettings(tickInterval, collectBufferSize, trackUnmatchedEntities, entityFilters, instrumentFactories, + defaultInstrumentFactory, refreshScheduler) + } + + /** + * Load all the default filters configured under the `kamon.metric.filters` configuration key. All filters are + * defined with the entity category as a sub-key of the `kamon.metric.filters` key and two sub-keys to it: includes + * and excludes with lists of string glob patterns as values. Example: + * + * {{{ + * + * kamon.metrics.filters { + * actor { + * includes = ["user/test-actor", "user/service/worker-*"] + * excludes = ["user/IO-*"] + * } + * } + * + * }}} + * + * @return a Map from category name to corresponding entity filter. + */ + def loadFilters(filtersConfig: Config): Map[String, EntityFilter] = { + import scala.collection.JavaConverters._ + + filtersConfig.firstLevelKeys map { category: String ⇒ + val includes = filtersConfig.getStringList(s"$category.includes").asScala.map(inc ⇒ new GlobPathFilter(inc)).toList + val excludes = filtersConfig.getStringList(s"$category.excludes").asScala.map(exc ⇒ new GlobPathFilter(exc)).toList + + (category, EntityFilter(includes, excludes)) + } toMap + } + + /** + * Load any custom configuration settings defined under the `kamon.metric.instrument-settings` configuration key and + * create InstrumentFactories for them. + * + * @return a Map from category name to InstrumentFactory. + */ + def loadInstrumentFactories(instrumentSettings: Config, defaults: DefaultInstrumentSettings, refreshScheduler: RefreshScheduler): Map[String, InstrumentFactory] = { + instrumentSettings.firstLevelKeys.map { category ⇒ + val categoryConfig = instrumentSettings.getConfig(category) + val customSettings = categoryConfig.firstLevelKeys.map { instrumentName ⇒ + (instrumentName, InstrumentCustomSettings.fromConfig(categoryConfig.getConfig(instrumentName))) + } toMap + + (category, new InstrumentFactory(customSettings, defaults, refreshScheduler)) + } toMap + } +} diff --git a/kamon-core/src/main/scala/kamon/metric/SimpleMetrics.scala b/kamon-core/src/main/scala/kamon/metric/SimpleMetrics.scala index b8dc54df..6324c320 100644 --- a/kamon-core/src/main/scala/kamon/metric/SimpleMetrics.scala +++ b/kamon-core/src/main/scala/kamon/metric/SimpleMetrics.scala @@ -22,7 +22,7 @@ import kamon.metric.instrument._ import scala.concurrent.duration.FiniteDuration -trait SimpleMetricsExtension { +trait SimpleMetrics { def histogram(name: String): Histogram def histogram(name: String, dynamicRange: DynamicRange): Histogram def histogram(name: String, unitOfMeasurement: UnitOfMeasurement): Histogram @@ -69,7 +69,7 @@ trait SimpleMetricsExtension { } -private[kamon] class SimpleMetricsExtensionImpl(instrumentFactory: InstrumentFactory) extends GenericEntityRecorder(instrumentFactory) with SimpleMetricsExtension { +private[kamon] class SimpleMetricsImpl(instrumentFactory: InstrumentFactory) extends GenericEntityRecorder(instrumentFactory) with SimpleMetrics { override def histogram(name: String): Histogram = super.histogram(name) @@ -191,12 +191,12 @@ private[kamon] class SimpleMetricsExtensionImpl(instrumentFactory: InstrumentFac super.removeCounter(key) } -private[kamon] object SimpleMetricsExtensionImpl { +private[kamon] object SimpleMetricsImpl { val SimpleMetricsEntity = Entity("simple-metric", "simple-metric") - def apply(metricsExtension: MetricsExtension): SimpleMetricsExtensionImpl = { + def apply(metricsExtension: Metrics): SimpleMetricsImpl = { val instrumentFactory = metricsExtension.instrumentFactory(SimpleMetricsEntity.category) - val simpleMetricsExtension = new SimpleMetricsExtensionImpl(instrumentFactory) + val simpleMetricsExtension = new SimpleMetricsImpl(instrumentFactory) metricsExtension.register(SimpleMetricsEntity, simpleMetricsExtension).recorder } diff --git a/kamon-core/src/main/scala/kamon/metric/SubscriptionsDispatcher.scala b/kamon-core/src/main/scala/kamon/metric/SubscriptionsDispatcher.scala index 68b545a5..3b6be70b 100644 --- a/kamon-core/src/main/scala/kamon/metric/SubscriptionsDispatcher.scala +++ b/kamon-core/src/main/scala/kamon/metric/SubscriptionsDispatcher.scala @@ -24,7 +24,7 @@ import scala.concurrent.duration.FiniteDuration /** * Manages subscriptions to metrics and dispatch snapshots on every tick to all subscribers. */ -private[kamon] class SubscriptionsDispatcher(interval: FiniteDuration, metricsExtension: MetricsExtensionImpl) extends Actor { +private[kamon] class SubscriptionsDispatcher(interval: FiniteDuration, metricsExtension: MetricsImpl) extends Actor { var lastTick = MilliTimestamp.now var oneShotSubscriptions = Map.empty[ActorRef, SubscriptionFilter] var permanentSubscriptions = Map.empty[ActorRef, SubscriptionFilter] @@ -81,7 +81,7 @@ private[kamon] class SubscriptionsDispatcher(interval: FiniteDuration, metricsEx } object SubscriptionsDispatcher { - def props(interval: FiniteDuration, metricsExtension: MetricsExtensionImpl): Props = + def props(interval: FiniteDuration, metricsExtension: MetricsImpl): Props = Props(new SubscriptionsDispatcher(interval, metricsExtension)) case object Tick -- cgit v1.2.3