From 2f0bf70826cfde49e980d362179717314290b6f1 Mon Sep 17 00:00:00 2001 From: Ivan Topolnjak Date: Sun, 18 May 2014 22:15:27 -0300 Subject: + core: allow dispatcher configuration to core components --- kamon-core/src/main/resources/reference.conf | 18 +++++++++------- .../scala/kamon/metrics/MetricsExtension.scala | 4 +--- .../src/main/scala/kamon/util/Contexts.scala | 24 ---------------------- 3 files changed, 12 insertions(+), 34 deletions(-) delete mode 100644 kamon-core/src/main/scala/kamon/util/Contexts.scala (limited to 'kamon-core') diff --git a/kamon-core/src/main/resources/reference.conf b/kamon-core/src/main/resources/reference.conf index b1e5309d..9abfd26a 100644 --- a/kamon-core/src/main/resources/reference.conf +++ b/kamon-core/src/main/resources/reference.conf @@ -3,22 +3,26 @@ # ================================== # kamon { + + # Default dispatcher for all Kamon components, unless a more specific one is configured. + default-dispatcher = "akka.actor.default-dispatcher" + metrics { - # Time interval at which Kamon will collect all metrics and send them to all subscribed actors. + # Time interval for collecting all metrics and send the snapshots to all subscribed actors. tick-interval = 1 second - # Time interval at which Kamon will record values for all registered gauges. + # Time interval for recording values on all registered gauges. gauge-recording-interval = 100 milliseconds + dispatchers { - # All Gauges record values periodically according to the `kamon.metrics.gauge-recording-interval` setting. - # This dispatcher is the one to be used to execute the recording code. - gauge-recordings = "akka.actor.default-dispatcher" + # Dispatcher for periodical gauge value recordings. + gauge-recordings = ${kamon.default-dispatcher} - # Dispatcher for the actor managing all subscriptions and metrics collection. - metric-subscriptions = "akka.actor.default-dispatcher" + # Dispatcher for subscriptions and metrics collection actors. + metric-subscriptions = ${kamon.default-dispatcher} } diff --git a/kamon-core/src/main/scala/kamon/metrics/MetricsExtension.scala b/kamon-core/src/main/scala/kamon/metrics/MetricsExtension.scala index 78a82d96..c60babb2 100644 --- a/kamon-core/src/main/scala/kamon/metrics/MetricsExtension.scala +++ b/kamon-core/src/main/scala/kamon/metrics/MetricsExtension.scala @@ -19,7 +19,7 @@ package kamon.metrics import scala.collection.concurrent.TrieMap import akka.actor._ import com.typesafe.config.Config -import kamon.util.{ Contexts, GlobPathFilter } +import kamon.util.GlobPathFilter import kamon.Kamon import akka.actor import kamon.metrics.Metrics.MetricGroupFilter @@ -92,8 +92,6 @@ class MetricsExtension(system: ExtendedActorSystem) extends Kamon.Extension { allFilters.toMap } - - val defaultDispatcher = Contexts.lookupExecutionContext(Contexts.kamonDefaultDispatcher)(system) } object Metrics extends ExtensionId[MetricsExtension] with ExtensionIdProvider { diff --git a/kamon-core/src/main/scala/kamon/util/Contexts.scala b/kamon-core/src/main/scala/kamon/util/Contexts.scala deleted file mode 100644 index be0d367e..00000000 --- a/kamon-core/src/main/scala/kamon/util/Contexts.scala +++ /dev/null @@ -1,24 +0,0 @@ -package kamon.util - -import akka.actor.ActorSystem - -/* - * ========================================================================================= - * Copyright © 2013-2014 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. - * ========================================================================================= - */ -object Contexts { - val kamonDefaultDispatcher = "kamon.default-dispatcher" - - def lookupExecutionContext(id: String)(implicit system: ActorSystem) = system.dispatchers.lookup(id) -} -- cgit v1.2.3