aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2015-02-14 11:04:22 +0100
committerIvan Topolnjak <ivantopo@gmail.com>2015-02-14 11:31:22 +0100
commit66b35556aa1bf0975cefa35603660991cdfcc526 (patch)
tree5bc71343929dcacca0d5576266c271b44e62f6ce
parent7da906da4fda6c6cd7eb6384bff0aef6b4ba094f (diff)
downloadKamon-66b35556aa1bf0975cefa35603660991cdfcc526.tar.gz
Kamon-66b35556aa1bf0975cefa35603660991cdfcc526.tar.bz2
Kamon-66b35556aa1bf0975cefa35603660991cdfcc526.zip
! core: special treatment of settings.
-rw-r--r--kamon-akka/src/main/resources/reference.conf2
-rw-r--r--kamon-akka/src/main/scala/kamon/akka/AkkaExtension.scala2
-rw-r--r--kamon-akka/src/test/scala/kamon/akka/DispatcherMetricsSpec.scala7
-rw-r--r--kamon-core/src/main/resources/reference.conf44
-rw-r--r--kamon-core/src/main/scala/kamon/Kamon.scala11
-rw-r--r--kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorExtension.scala4
-rw-r--r--kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorSettings.scala6
-rw-r--r--kamon-play/src/main/resources/reference.conf1
-rw-r--r--kamon-play/src/main/scala/kamon/play/Play.scala2
9 files changed, 34 insertions, 45 deletions
diff --git a/kamon-akka/src/main/resources/reference.conf b/kamon-akka/src/main/resources/reference.conf
index 5f35e267..cc2b6060 100644
--- a/kamon-akka/src/main/resources/reference.conf
+++ b/kamon-akka/src/main/resources/reference.conf
@@ -12,8 +12,6 @@ kamon {
# - heavyweight: logs the warning when a timeout is reached using a stack trace captured at the moment the future was created.
ask-pattern-timeout-warning = off
- # Default dispatcher for all akka module operations
- dispatcher = kamon.default-dispatcher
}
metric.filters {
diff --git a/kamon-akka/src/main/scala/kamon/akka/AkkaExtension.scala b/kamon-akka/src/main/scala/kamon/akka/AkkaExtension.scala
index cbca7db6..5b3d19d4 100644
--- a/kamon-akka/src/main/scala/kamon/akka/AkkaExtension.scala
+++ b/kamon-akka/src/main/scala/kamon/akka/AkkaExtension.scala
@@ -23,7 +23,7 @@ import kamon._
class AkkaExtension(system: ExtendedActorSystem) extends Kamon.Extension {
val config = system.settings.config.getConfig("kamon.akka")
val askPatternTimeoutWarning = config.getString("ask-pattern-timeout-warning")
- val dispatcher = system.dispatchers.lookup(config.getString("dispatcher"))
+ val dispatcher = system.dispatcher
}
object Akka extends ExtensionId[AkkaExtension] with ExtensionIdProvider {
diff --git a/kamon-akka/src/test/scala/kamon/akka/DispatcherMetricsSpec.scala b/kamon-akka/src/test/scala/kamon/akka/DispatcherMetricsSpec.scala
index 209b5cf5..2379bff5 100644
--- a/kamon-akka/src/test/scala/kamon/akka/DispatcherMetricsSpec.scala
+++ b/kamon-akka/src/test/scala/kamon/akka/DispatcherMetricsSpec.scala
@@ -15,17 +15,14 @@
package kamon.akka
-import java.nio.LongBuffer
-import akka.actor.{ ActorRef, ActorSystem }
+import akka.actor.ActorRef
import akka.dispatch.MessageDispatcher
-import akka.testkit.{ TestKitBase, TestProbe }
+import akka.testkit.TestProbe
import com.typesafe.config.ConfigFactory
import kamon.Kamon
-import kamon.metric.instrument.CollectionContext
import kamon.metric.{ EntityRecorder, EntitySnapshot }
import kamon.testkit.BaseKamonSpec
-import org.scalatest.{ BeforeAndAfterAll, Matchers, WordSpecLike }
import scala.concurrent.duration._
import scala.concurrent.{ Await, Future }
diff --git a/kamon-core/src/main/resources/reference.conf b/kamon-core/src/main/resources/reference.conf
index 746652eb..a648c01a 100644
--- a/kamon-core/src/main/resources/reference.conf
+++ b/kamon-core/src/main/resources/reference.conf
@@ -82,15 +82,6 @@ kamon {
instrument-settings {
}
-
- dispatchers {
-
- # Dispatcher for the actor that will collect all recorded metrics on every tick and dispatch them to all subscribers.
- metric-collection = kamon.default-dispatcher
-
- # Dispatcher for the Kamon refresh scheduler, used by all MinMaxCounters and Gaugues to update their values.
- refresh-scheduler = kamon.default-dispatcher
- }
}
@@ -140,35 +131,30 @@ kamon {
# open after this point.
max-incubation-time = 20 seconds
}
-
- # Default dispatcher for all trace module operations
- dispatcher = kamon.default-dispatcher
}
- default-dispatcher {
- # Dispatcher is the name of the event-based dispatcher
- type = Dispatcher
- # What kind of ExecutionService to use
- executor = "fork-join-executor"
+ # All settings included under the internal-config key will be used to repleace the akka.* and spray.* settings. By
+ # doing this we avoid applying custom settings that might make sense for the user application to the internal actor
+ # system and Spray facilities used by Kamon.
+ internal-config {
- # Configuration for the fork join pool
- fork-join-executor {
- # Min number of threads to cap factor-based parallelism number to
- parallelism-min = 2
+ akka.actor.default-dispatcher {
+ fork-join-executor {
+ parallelism-min = 2
+ parallelism-factor = 2.0
+ parallelism-max = 10
+ }
+ }
- # The parallelism factor is used to determine thread pool size using the
- # following formula: ceil(available processors * factor). Resulting size
- # is then bounded by the parallelism-min and parallelism-max values.
- parallelism-factor = 2.0
+ spray {
- # Max number of threads to cap factor-based parallelism number to
- parallelism-max = 10
}
}
-
- disable-aspectj-missing-warning = false
+ # Controls whether the AspectJ Weaver missing warning should be displayed if any Kamon module requiring AspectJ is
+ # found in the classpath but the application is started without the AspectJ Weaver.
+ show-aspectj-missing-warning = yes
modules {
# Just a place holder to ensure that the key is always available. Non-core Kamon modules should provide their
diff --git a/kamon-core/src/main/scala/kamon/Kamon.scala b/kamon-core/src/main/scala/kamon/Kamon.scala
index 2bed4737..ab9ce05e 100644
--- a/kamon-core/src/main/scala/kamon/Kamon.scala
+++ b/kamon-core/src/main/scala/kamon/Kamon.scala
@@ -32,13 +32,22 @@ object Kamon {
@volatile private var _coreComponents: Option[KamonCoreComponents] = None
def start(config: Config): Unit = synchronized {
+ def resolveInternalConfig: Config = {
+ val internalConfig = config.getConfig("kamon.internal-config")
+
+ config
+ .withoutPath("akka")
+ .withoutPath("spray")
+ .withFallback(internalConfig)
+ }
+
if (_coreComponents.isEmpty) {
val metrics = MetricsExtensionImpl(config)
val simpleMetrics = UserMetricsExtensionImpl(metrics)
val tracer = TracerExtensionImpl(metrics, config)
_coreComponents = Some(KamonCoreComponents(metrics, tracer, simpleMetrics))
- _system = ActorSystem("kamon", config)
+ _system = ActorSystem("kamon", resolveInternalConfig)
metrics.start(_system)
tracer.start(_system)
diff --git a/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorExtension.scala b/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorExtension.scala
index e47d0216..ddce63fb 100644
--- a/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorExtension.scala
+++ b/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorExtension.scala
@@ -62,7 +62,7 @@ class KamonSupervisor(settings: ModuleSupervisorSettings, dynamicAccess: Dynamic
} getOrElse (childPromise.complete(Success(context.actorOf(props, name))))
def init(): Unit = {
- if (settings.modulesRequiringAspectJ.nonEmpty && !isAspectJPresent && !settings.disableAspectJMissingWarning)
+ if (settings.modulesRequiringAspectJ.nonEmpty && !isAspectJPresent && settings.showAspectJMissingWarning)
logAspectJWeaverMissing(settings.modulesRequiringAspectJ)
// Force initialization of all modules marked with auto-start.
@@ -106,7 +106,7 @@ class KamonSupervisor(settings: ModuleSupervisorSettings, dynamicAccess: Dynamic
|
| If you need help on setting up the aspectj weaver go to http://kamon.io/introduction/get-started/ for more info. On the
| other hand, if you are sure that you do not need or do not want to use the weaver then you can disable this error message
- | by changing the kamon.disable-aspectj-missing-warning setting in your configuration file.
+ | by changing the kamon.show-aspectj-missing-warning setting in your configuration file.
|
""".stripMargin
diff --git a/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorSettings.scala b/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorSettings.scala
index 1b7d8a2e..c04157aa 100644
--- a/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorSettings.scala
+++ b/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorSettings.scala
@@ -19,7 +19,7 @@ package kamon.supervisor
import akka.actor.ActorSystem
case class AvailableModuleInfo(name: String, extensionClass: String, requiresAspectJ: Boolean, autoStart: Boolean)
-case class ModuleSupervisorSettings(disableAspectJMissingWarning: Boolean, availableModules: List[AvailableModuleInfo]) {
+case class ModuleSupervisorSettings(showAspectJMissingWarning: Boolean, availableModules: List[AvailableModuleInfo]) {
val modulesRequiringAspectJ = availableModules.filter(_.requiresAspectJ)
}
@@ -29,7 +29,7 @@ object ModuleSupervisorSettings {
import kamon.util.ConfigTools.Syntax
val config = system.settings.config.getConfig("kamon.modules")
- val disableAspectJMissingWarning = system.settings.config.getBoolean("kamon.disable-aspectj-missing-warning")
+ val showAspectJMissingWarning = system.settings.config.getBoolean("kamon.show-aspectj-missing-warning")
val modules = config.firstLevelKeys
val availableModules = modules.map { moduleName ⇒
@@ -43,7 +43,7 @@ object ModuleSupervisorSettings {
} toList
- ModuleSupervisorSettings(disableAspectJMissingWarning, availableModules)
+ ModuleSupervisorSettings(showAspectJMissingWarning, availableModules)
}
}
diff --git a/kamon-play/src/main/resources/reference.conf b/kamon-play/src/main/resources/reference.conf
index 8dd7240e..88f1de26 100644
--- a/kamon-play/src/main/resources/reference.conf
+++ b/kamon-play/src/main/resources/reference.conf
@@ -21,7 +21,6 @@ kamon {
# to traces and client http segments.
name-generator = kamon.play.DefaultPlayNameGenerator
- dispatcher = kamon.default-dispatcher
}
modules {
diff --git a/kamon-play/src/main/scala/kamon/play/Play.scala b/kamon-play/src/main/scala/kamon/play/Play.scala
index 3c3e4fa7..9e160d58 100644
--- a/kamon-play/src/main/scala/kamon/play/Play.scala
+++ b/kamon-play/src/main/scala/kamon/play/Play.scala
@@ -44,7 +44,7 @@ class PlayExtension(private val system: ExtendedActorSystem) extends Kamon.Exten
metricsExtension.register(entity, new HttpServerMetrics(factory)).recorder
}
- val defaultDispatcher = system.dispatchers.lookup(config.getString("dispatcher"))
+ val defaultDispatcher = system.dispatcher
val includeTraceToken: Boolean = config.getBoolean("automatic-trace-token-propagation")
val traceTokenHeaderName: String = config.getString("trace-token-header-name")