aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2015-01-30 03:25:54 +0100
committerIvan Topolnjak <ivantopo@gmail.com>2015-01-30 03:25:54 +0100
commitaa1980de105ce128ba75099815f97de3d0d4b552 (patch)
tree4ca0acdd72f8316ef778f5702c8ad40af613884f
parented950a320c7b3edba36d07288a69fb0049b33063 (diff)
downloadKamon-aa1980de105ce128ba75099815f97de3d0d4b552.tar.gz
Kamon-aa1980de105ce128ba75099815f97de3d0d4b552.tar.bz2
Kamon-aa1980de105ce128ba75099815f97de3d0d4b552.zip
+ all: use ModuleSupervisor init all auto-start modules.
The new ModuleSupervisor implementation will make use of special configuration keys under the `kamon.modules` section to detect all the available modules in the classpath and do two things with that info: 1. Log the AspectJ Weaver missing error if any of the available modules requires AspectJ. 2. Start all available modules that are marked with the auto-start setting.
-rw-r--r--kamon-akka-remote/src/main/resources/reference.conf14
-rw-r--r--kamon-akka/src/main/resources/reference.conf9
-rw-r--r--kamon-core/src/main/resources/META-INF/aop.xml4
-rw-r--r--kamon-core/src/main/resources/reference.conf8
-rw-r--r--kamon-core/src/main/scala/kamon/Kamon.scala6
-rw-r--r--kamon-core/src/main/scala/kamon/ModuleSupervisor.scala65
-rw-r--r--kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala28
-rw-r--r--kamon-core/src/main/scala/kamon/supervisor/AspectJPresent.scala15
-rw-r--r--kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorExtension.scala109
-rw-r--r--kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorSettings.scala33
-rw-r--r--kamon-datadog/src/main/resources/reference.conf16
-rw-r--r--kamon-datadog/src/main/scala/kamon/datadog/Datadog.scala2
-rw-r--r--kamon-jdbc/src/main/resources/reference.conf10
-rw-r--r--kamon-log-reporter/src/main/resources/reference.conf9
-rw-r--r--kamon-newrelic/src/main/resources/reference.conf8
-rw-r--r--kamon-newrelic/src/test/scala/kamon/newrelic/AgentSpec.scala2
-rw-r--r--kamon-newrelic/src/test/scala/kamon/newrelic/MetricReporterSpec.scala2
-rw-r--r--kamon-play/src/main/resources/reference.conf8
-rw-r--r--kamon-playground/src/main/resources/application.conf31
-rw-r--r--kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala1
-rw-r--r--kamon-scala/src/main/resources/reference.conf14
-rw-r--r--kamon-spray/src/main/resources/reference.conf8
-rw-r--r--kamon-statsd/src/main/resources/reference.conf8
-rw-r--r--kamon-system-metrics/src/main/resources/reference.conf8
-rw-r--r--kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsExtension.scala3
25 files changed, 299 insertions, 122 deletions
diff --git a/kamon-akka-remote/src/main/resources/reference.conf b/kamon-akka-remote/src/main/resources/reference.conf
new file mode 100644
index 00000000..7c6be896
--- /dev/null
+++ b/kamon-akka-remote/src/main/resources/reference.conf
@@ -0,0 +1,14 @@
+# ========================================= #
+# Kamon-Akka-Remote Reference Configuration #
+# ========================================= #
+
+kamon {
+
+ modules {
+ kamon-akka-remote {
+ auto-start = yes
+ requires-aspectj = yes
+ extension-id = none
+ }
+ }
+} \ No newline at end of file
diff --git a/kamon-akka/src/main/resources/reference.conf b/kamon-akka/src/main/resources/reference.conf
index 1ffe7a7f..5f35e267 100644
--- a/kamon-akka/src/main/resources/reference.conf
+++ b/kamon-akka/src/main/resources/reference.conf
@@ -20,4 +20,13 @@ kamon {
actor.includes = []
actor.excludes = [ "", "user", "system**", "user/IO-**" ]
}
+
+
+ modules {
+ kamon-akka {
+ auto-start = yes
+ requires-aspectj = yes
+ extension-id = "kamon.akka.Akka"
+ }
+ }
} \ No newline at end of file
diff --git a/kamon-core/src/main/resources/META-INF/aop.xml b/kamon-core/src/main/resources/META-INF/aop.xml
index 854e9437..2ffb8b09 100644
--- a/kamon-core/src/main/resources/META-INF/aop.xml
+++ b/kamon-core/src/main/resources/META-INF/aop.xml
@@ -3,8 +3,8 @@
<aspectj>
<aspects>
- <!-- Disable AspectJ Weaver not present error -->
- <aspect name="kamon.instrumentation.AspectJWeaverMissingWarning"/>
+ <!-- Notify that AspectJ is present -->
+ <aspect name="kamon.supervisor.AspectJPresent"/>
</aspects>
diff --git a/kamon-core/src/main/resources/reference.conf b/kamon-core/src/main/resources/reference.conf
index dabeda69..746652eb 100644
--- a/kamon-core/src/main/resources/reference.conf
+++ b/kamon-core/src/main/resources/reference.conf
@@ -166,4 +166,12 @@ kamon {
parallelism-max = 10
}
}
+
+
+ disable-aspectj-missing-warning = false
+
+ modules {
+ # Just a place holder to ensure that the key is always available. Non-core Kamon modules should provide their
+ # settings in a module-info section.
+ }
} \ No newline at end of file
diff --git a/kamon-core/src/main/scala/kamon/Kamon.scala b/kamon-core/src/main/scala/kamon/Kamon.scala
index d29061f8..6fedc065 100644
--- a/kamon-core/src/main/scala/kamon/Kamon.scala
+++ b/kamon-core/src/main/scala/kamon/Kamon.scala
@@ -18,6 +18,7 @@ import _root_.akka.actor
import _root_.akka.actor._
import com.typesafe.config.Config
import kamon.metric._
+import kamon.supervisor.ModuleSupervisor
import kamon.trace.{ Tracer, TracerExtension }
class Kamon(val actorSystem: ActorSystem) {
@@ -25,7 +26,10 @@ class Kamon(val actorSystem: ActorSystem) {
val tracer: TracerExtension = Tracer.get(actorSystem)
val userMetrics: UserMetricsExtension = UserMetrics.get(actorSystem)
- def shutdown: Unit =
+ // This will cause all auto-start modules to initiate.
+ ModuleSupervisor.get(actorSystem)
+
+ def shutdown(): Unit =
actorSystem.shutdown()
}
diff --git a/kamon-core/src/main/scala/kamon/ModuleSupervisor.scala b/kamon-core/src/main/scala/kamon/ModuleSupervisor.scala
deleted file mode 100644
index 44daa6a7..00000000
--- a/kamon-core/src/main/scala/kamon/ModuleSupervisor.scala
+++ /dev/null
@@ -1,65 +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
-
-import _root_.akka.actor
-import _root_.akka.actor._
-import kamon.ModuleSupervisor.CreateModule
-
-import scala.concurrent.{ Future, Promise }
-import scala.util.Success
-
-object ModuleSupervisor extends ExtensionId[ModuleSupervisorExtension] with ExtensionIdProvider {
-
- def lookup(): ExtensionId[_ <: actor.Extension] = ModuleSupervisor
- def createExtension(system: ExtendedActorSystem): ModuleSupervisorExtension = new ModuleSupervisorExtensionImpl(system)
-
- case class CreateModule(name: String, props: Props, childPromise: Promise[ActorRef])
-}
-
-trait ModuleSupervisorExtension extends actor.Extension {
- def createModule(name: String, props: Props): Future[ActorRef]
-}
-
-class ModuleSupervisorExtensionImpl(system: ExtendedActorSystem) extends ModuleSupervisorExtension {
- import system.dispatcher
- private val supervisor = system.actorOf(Props[ModuleSupervisor], "kamon")
-
- def createModule(name: String, props: Props): Future[ActorRef] = Future {} flatMap { _: Unit ⇒
- val modulePromise = Promise[ActorRef]()
- supervisor ! CreateModule(name, props, modulePromise)
- modulePromise.future
- }
-}
-
-class ModuleSupervisor extends Actor with ActorLogging {
-
- def receive = {
- case CreateModule(name, props, childPromise) ⇒ createChildModule(name, props, childPromise)
- }
-
- def createChildModule(name: String, props: Props, childPromise: Promise[ActorRef]): Unit = {
-
- context.child(name).map { alreadyAvailableModule ⇒
- log.warning("Received a request to create module [{}] but the module is already available, returning the existent one.")
- childPromise.complete(Success(alreadyAvailableModule))
-
- } getOrElse {
- childPromise.complete(Success(context.actorOf(props, name)))
- }
- }
-}
diff --git a/kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala b/kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala
index 0b7fc7f2..c14d4e16 100644
--- a/kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala
+++ b/kamon-core/src/main/scala/kamon/metric/MetricsExtension.scala
@@ -18,8 +18,9 @@ package kamon.metric
import akka.actor
import kamon.metric.SubscriptionsDispatcher.{ Unsubscribe, Subscribe }
-import kamon.{ ModuleSupervisor, Kamon }
+import kamon.Kamon
import kamon.metric.instrument.{ InstrumentFactory, CollectionContext }
+import kamon.supervisor.ModuleSupervisor
import scala.collection.concurrent.TrieMap
import akka.actor._
@@ -127,30 +128,5 @@ class MetricsExtensionImpl(system: ExtendedActorSystem) extends MetricsExtension
builder.result()
}
-
- /* def printInitializationMessage(eventStream: EventStream, disableWeaverMissingError: Boolean): Unit = {
- if (!disableWeaverMissingError) {
- val weaverMissingMessage =
- """
- |
- | ___ _ ___ _ _ ___ ___ _ _
- | / _ \ | | |_ | | | | | | \/ |(_) (_)
- |/ /_\ \ ___ _ __ ___ ___ | |_ | | | | | | ___ __ _ __ __ ___ _ __ | . . | _ ___ ___ _ _ __ __ _
- || _ |/ __|| '_ \ / _ \ / __|| __| | | | |/\| | / _ \ / _` |\ \ / // _ \| '__| | |\/| || |/ __|/ __|| || '_ \ / _` |
- || | | |\__ \| |_) || __/| (__ | |_ /\__/ / \ /\ /| __/| (_| | \ V /| __/| | | | | || |\__ \\__ \| || | | || (_| |
- |\_| |_/|___/| .__/ \___| \___| \__|\____/ \/ \/ \___| \__,_| \_/ \___||_| \_| |_/|_||___/|___/|_||_| |_| \__, |
- | | | __/ |
- | |_| |___/
- |
- | It seems like your application wasn't started with the -javaagent:/path-to-aspectj-weaver.jar option. Without that Kamon might
- | not work properly, if you need help on setting up the weaver go to http://kamon.io/introduction/get-started/ for more info. If
- | you are sure that you don't need the weaver (e.g. you are only using KamonStandalone) then you can disable this error message
- | by changing the kamon.metrics.disable-aspectj-weaver-missing-error setting in your configuration file.
- |
- """.stripMargin
-
- eventStream.publish(Error("MetricsExtension", classOf[MetricsExtension], weaverMissingMessage))
- }
- }*/
}
diff --git a/kamon-core/src/main/scala/kamon/supervisor/AspectJPresent.scala b/kamon-core/src/main/scala/kamon/supervisor/AspectJPresent.scala
new file mode 100644
index 00000000..bbb8b69b
--- /dev/null
+++ b/kamon-core/src/main/scala/kamon/supervisor/AspectJPresent.scala
@@ -0,0 +1,15 @@
+package kamon.supervisor
+
+import org.aspectj.lang.ProceedingJoinPoint
+import org.aspectj.lang.annotation.{ Around, Aspect, Pointcut }
+
+@Aspect
+class AspectJPresent {
+
+ @Pointcut("execution(* kamon.supervisor.KamonSupervisor.isAspectJPresent())")
+ def isAspectJPresentAtModuleSupervisor(): Unit = {}
+
+ @Around("isAspectJPresentAtModuleSupervisor()")
+ def aroundIsAspectJPresentAtModuleSupervisor(pjp: ProceedingJoinPoint): Boolean = true
+
+}
diff --git a/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorExtension.scala b/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorExtension.scala
new file mode 100644
index 00000000..1ff6bfc6
--- /dev/null
+++ b/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorExtension.scala
@@ -0,0 +1,109 @@
+package kamon.supervisor
+
+import akka.actor
+import akka.actor._
+import kamon.Kamon
+import kamon.supervisor.KamonSupervisor.CreateModule
+
+import scala.concurrent.{ Promise, Future }
+import scala.util.Success
+
+object ModuleSupervisor extends ExtensionId[ModuleSupervisorExtension] with ExtensionIdProvider {
+ def lookup(): ExtensionId[_ <: actor.Extension] = ModuleSupervisor
+ def createExtension(system: ExtendedActorSystem): ModuleSupervisorExtension = new ModuleSupervisorExtensionImpl(system)
+}
+
+trait ModuleSupervisorExtension extends actor.Extension {
+ def createModule(name: String, props: Props): Future[ActorRef]
+}
+
+class ModuleSupervisorExtensionImpl(system: ExtendedActorSystem) extends ModuleSupervisorExtension {
+ import system.dispatcher
+
+ private val _settings = ModuleSupervisorSettings(system)
+ private val _supervisor = system.actorOf(KamonSupervisor.props(_settings, system.dynamicAccess), "kamon")
+
+ def createModule(name: String, props: Props): Future[ActorRef] = Future {} flatMap { _: Unit ⇒
+ val modulePromise = Promise[ActorRef]()
+ _supervisor ! CreateModule(name, props, modulePromise)
+ modulePromise.future
+ }
+}
+
+class KamonSupervisor(settings: ModuleSupervisorSettings, dynamicAccess: DynamicAccess) extends Actor with ActorLogging {
+
+ init()
+
+ def receive = {
+ case CreateModule(name, props, childPromise) ⇒ createChildModule(name, props, childPromise)
+ }
+
+ def createChildModule(name: String, props: Props, childPromise: Promise[ActorRef]): Unit =
+ context.child(name).map { alreadyAvailableModule ⇒
+ log.warning("Received a request to create module [{}] but the module is already available, returning the existent instance.")
+ childPromise.complete(Success(alreadyAvailableModule))
+
+ } getOrElse (childPromise.complete(Success(context.actorOf(props, name))))
+
+ def init(): Unit = {
+ if (settings.modulesRequiringAspectJ.nonEmpty && !isAspectJPresent && !settings.disableAspectJMissingWarning)
+ logAspectJWeaverMissing(settings.modulesRequiringAspectJ)
+
+ // Force initialization of all modules marked with auto-start.
+ settings.availableModules.filter(_.autoStart).foreach { module ⇒
+ if (module.extensionClass == "none")
+ log.debug("Ignoring auto start of the [{}] module with no extension class.")
+ else
+ dynamicAccess.getObjectFor[ExtensionId[Kamon.Extension]](module.extensionClass).map { moduleID ⇒
+ moduleID.get(context.system)
+ log.debug("Auto starting the [{}] module.", module.name)
+
+ } recover {
+ case th: Throwable ⇒ log.error(th, "Failed to auto start the [{}] module.", module.name)
+ }
+
+ }
+ }
+
+ // When AspectJ is present the kamon.supervisor.AspectJPresent aspect will make this return true.
+ def isAspectJPresent: Boolean = false
+
+ def logAspectJWeaverMissing(modulesRequiringAspectJ: List[AvailableModuleInfo]): Unit = {
+ val moduleNames = modulesRequiringAspectJ.map(_.name).mkString(", ")
+ val weaverMissingMessage =
+ """
+ |
+ | ___ _ ___ _ _ ___ ___ _ _
+ | / _ \ | | |_ | | | | | | \/ |(_) (_)
+ |/ /_\ \ ___ _ __ ___ ___ | |_ | | | | | | ___ __ _ __ __ ___ _ __ | . . | _ ___ ___ _ _ __ __ _
+ || _ |/ __|| '_ \ / _ \ / __|| __| | | | |/\| | / _ \ / _` |\ \ / // _ \| '__| | |\/| || |/ __|/ __|| || '_ \ / _` |
+ || | | |\__ \| |_) || __/| (__ | |_ /\__/ / \ /\ /| __/| (_| | \ V /| __/| | | | | || |\__ \\__ \| || | | || (_| |
+ |\_| |_/|___/| .__/ \___| \___| \__|\____/ \/ \/ \___| \__,_| \_/ \___||_| \_| |_/|_||___/|___/|_||_| |_| \__, |
+ | | | __/ |
+ | |_| |___/
+ |
+ | It seems like your application was not started with the -javaagent:/path-to-aspectj-weaver.jar option but Kamon detected
+ | the following modules which require AspecJ to work properly:
+ |
+ """.stripMargin + moduleNames +
+ """
+ |
+ | 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.
+ |
+ """.stripMargin
+
+ log.error(weaverMissingMessage)
+ }
+
+}
+
+object KamonSupervisor {
+ case class CreateModule(name: String, props: Props, childPromise: Promise[ActorRef])
+
+ def props(settings: ModuleSupervisorSettings, dynamicAccess: DynamicAccess): Props =
+ Props(new KamonSupervisor(settings, dynamicAccess))
+
+}
+
diff --git a/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorSettings.scala b/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorSettings.scala
new file mode 100644
index 00000000..c5556004
--- /dev/null
+++ b/kamon-core/src/main/scala/kamon/supervisor/ModuleSupervisorSettings.scala
@@ -0,0 +1,33 @@
+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]) {
+ val modulesRequiringAspectJ = availableModules.filter(_.requiresAspectJ)
+}
+
+object ModuleSupervisorSettings {
+
+ def apply(system: ActorSystem): 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 modules = config.firstLevelKeys
+ val availableModules = modules.map { moduleName ⇒
+ val moduleConfig = config.getConfig(moduleName)
+
+ AvailableModuleInfo(
+ moduleName,
+ moduleConfig.getString("extension-id"),
+ moduleConfig.getBoolean("requires-aspectj"),
+ moduleConfig.getBoolean("auto-start"))
+
+ } toList
+
+ ModuleSupervisorSettings(disableAspectJMissingWarning, availableModules)
+ }
+
+}
diff --git a/kamon-datadog/src/main/resources/reference.conf b/kamon-datadog/src/main/resources/reference.conf
index 4d0639c0..07a5c8e4 100644
--- a/kamon-datadog/src/main/resources/reference.conf
+++ b/kamon-datadog/src/main/resources/reference.conf
@@ -1,6 +1,6 @@
-# ==================================== #
+# ===================================== #
# Kamon-Datadog Reference Configuration #
-# ==================================== #
+# ===================================== #
kamon {
datadog {
@@ -11,7 +11,7 @@ kamon {
# Interval between metrics data flushes to Datadog. It's value must be equal or greater than the
# kamon.metrics.tick-interval setting.
- flush-interval = 1 second
+ flush-interval = 10 seconds
# Max packet size for UDP metrics data sent to Datadog.
max-packet-size = 1024 bytes
@@ -35,4 +35,12 @@ kamon {
# application.entity-name.metric-name
application-name = "kamon"
}
-}
+
+ modules {
+ kamon-datadog {
+ auto-start = yes
+ requires-aspectj = no
+ extension-id = "kamon.datadog.Datadog"
+ }
+ }
+} \ No newline at end of file
diff --git a/kamon-datadog/src/main/scala/kamon/datadog/Datadog.scala b/kamon-datadog/src/main/scala/kamon/datadog/Datadog.scala
index 2648d6ef..b7375d9b 100644
--- a/kamon-datadog/src/main/scala/kamon/datadog/Datadog.scala
+++ b/kamon-datadog/src/main/scala/kamon/datadog/Datadog.scala
@@ -43,7 +43,7 @@ class DatadogExtension(system: ExtendedActorSystem) extends Kamon.Extension {
val datadogHost = new InetSocketAddress(datadogConfig.getString("hostname"), datadogConfig.getInt("port"))
val flushInterval = datadogConfig.getDuration("flush-interval", MILLISECONDS)
val maxPacketSizeInBytes = datadogConfig.getBytes("max-packet-size")
- val tickInterval = system.settings.config.getDuration("kamon.metrics.tick-interval", MILLISECONDS)
+ val tickInterval = system.settings.config.getDuration("kamon.metric.tick-interval", MILLISECONDS)
val datadogMetricsListener = buildMetricsListener(tickInterval, flushInterval)
diff --git a/kamon-jdbc/src/main/resources/reference.conf b/kamon-jdbc/src/main/resources/reference.conf
index e697d58c..e058c873 100644
--- a/kamon-jdbc/src/main/resources/reference.conf
+++ b/kamon-jdbc/src/main/resources/reference.conf
@@ -14,5 +14,13 @@ kamon {
# Fully qualified name of the implementation of kamon.jdbc.JdbcNameGenerator that will be used for assigning names to segments.
name-generator = kamon.jdbc.DefaultJdbcNameGenerator
- }
+ }
+
+ modules {
+ kamon-jdbc {
+ auto-start = yes
+ requires-aspectj = yes
+ extension-id = "kamon.jdbc.Jdbc"
+ }
+ }
} \ No newline at end of file
diff --git a/kamon-log-reporter/src/main/resources/reference.conf b/kamon-log-reporter/src/main/resources/reference.conf
index 0f7e4e9a..080d8a76 100644
--- a/kamon-log-reporter/src/main/resources/reference.conf
+++ b/kamon-log-reporter/src/main/resources/reference.conf
@@ -4,8 +4,15 @@
kamon {
log-reporter {
-
# Decide whether the log reporter should log system metrics, if available.
report-system-metrics = false
}
+
+ modules {
+ kamon-log-reporter {
+ auto-start = yes
+ requires-aspectj = no
+ extension-id = "kamon.logreporter.LogReporter"
+ }
+ }
}
diff --git a/kamon-newrelic/src/main/resources/reference.conf b/kamon-newrelic/src/main/resources/reference.conf
index dd112aeb..9dc793e1 100644
--- a/kamon-newrelic/src/main/resources/reference.conf
+++ b/kamon-newrelic/src/main/resources/reference.conf
@@ -24,6 +24,14 @@ kamon {
# delay between connection attempts to NewRelic collector
connect-retry-delay = 30 seconds
}
+
+ modules {
+ kamon-newrelic {
+ auto-start = yes
+ requires-aspectj = no
+ extension-id = "kamon.newrelic.NewRelic"
+ }
+ }
}
diff --git a/kamon-newrelic/src/test/scala/kamon/newrelic/AgentSpec.scala b/kamon-newrelic/src/test/scala/kamon/newrelic/AgentSpec.scala
index 05d3533b..3e15e9fd 100644
--- a/kamon-newrelic/src/test/scala/kamon/newrelic/AgentSpec.scala
+++ b/kamon-newrelic/src/test/scala/kamon/newrelic/AgentSpec.scala
@@ -47,6 +47,8 @@ class AgentSpec extends TestKitBase with WordSpecLike with BeforeAndAfterAll wit
| connect-retry-delay = 1 second
| max-connect-retries = 3
| }
+ |
+ | modules.kamon-newrelic.auto-start = no
|}
|
""".stripMargin))
diff --git a/kamon-newrelic/src/test/scala/kamon/newrelic/MetricReporterSpec.scala b/kamon-newrelic/src/test/scala/kamon/newrelic/MetricReporterSpec.scala
index 13ccbae3..a8aa00d7 100644
--- a/kamon-newrelic/src/test/scala/kamon/newrelic/MetricReporterSpec.scala
+++ b/kamon-newrelic/src/test/scala/kamon/newrelic/MetricReporterSpec.scala
@@ -48,6 +48,8 @@ class MetricReporterSpec extends TestKitBase with WordSpecLike with Matchers wit
| metric {
| tick-interval = 1 hour
| }
+ |
+ | modules.kamon-newrelic.auto-start = no
|}
|
""".stripMargin))
diff --git a/kamon-play/src/main/resources/reference.conf b/kamon-play/src/main/resources/reference.conf
index 7456bbb4..fbf0eb55 100644
--- a/kamon-play/src/main/resources/reference.conf
+++ b/kamon-play/src/main/resources/reference.conf
@@ -23,4 +23,12 @@ kamon {
dispatcher = "akka.actor.default-dispatcher"
}
+
+ modules {
+ kamon-play {
+ auto-start = yes
+ requires-aspectj = yes
+ extension-id = "kamon.play.Play"
+ }
+ }
} \ No newline at end of file
diff --git a/kamon-playground/src/main/resources/application.conf b/kamon-playground/src/main/resources/application.conf
index 11f06334..74e710bc 100644
--- a/kamon-playground/src/main/resources/application.conf
+++ b/kamon-playground/src/main/resources/application.conf
@@ -1,6 +1,5 @@
akka {
- loglevel = INFO
- extensions = ["kamon.statsd.StatsD", "kamon.system.SystemMetrics"]
+ loglevel = DEBUG
actor {
debug {
@@ -16,13 +15,6 @@ spray.can {
}
kamon {
- newrelic {
- app-name = "SimpleRequestProcessor"
- license-key = e7d350b14228f3d28f35bc3140df2c3e565ea5d5
- }
-}
-
-kamon {
trace {
level = simple-trace
}
@@ -34,16 +26,15 @@ kamon {
}
}
-}
-
+ newrelic {
+ app-name = "SimpleRequestProcessor"
+ license-key = e7d350b14228f3d28f35bc3140df2c3e565ea5d5
+ }
-kamon {
- metrics {
- actors {
- tracked = [
- "user/simple-service-actor",
- "other"
- ]
- }
+ modules {
+ kamon-newrelic.auto-start = no
+ kamon-datadog.auto-start = no
+ kamon-log-reporter.auto-start = no
+ kamon-system-metrics.auto-start = no
}
-} \ No newline at end of file
+}
diff --git a/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala b/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala
index 94c91a8a..67ab3c97 100644
--- a/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala
+++ b/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala
@@ -38,6 +38,7 @@ object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuil
import scala.concurrent.duration._
implicit val system = ActorSystem("test")
+ val kamon = Kamon(system)
import test.SimpleRequestProcessor.system.dispatcher
val printer = system.actorOf(Props[PrintWhatever])
diff --git a/kamon-scala/src/main/resources/reference.conf b/kamon-scala/src/main/resources/reference.conf
new file mode 100644
index 00000000..1a621e09
--- /dev/null
+++ b/kamon-scala/src/main/resources/reference.conf
@@ -0,0 +1,14 @@
+# =================================== #
+# Kamon-Scala Reference Configuration #
+# =================================== #
+
+kamon {
+
+ module-info {
+ kamons {
+ auto-start = yes
+ requires-aspectj = yes
+ extension-id = none
+ }
+ }
+} \ No newline at end of file
diff --git a/kamon-spray/src/main/resources/reference.conf b/kamon-spray/src/main/resources/reference.conf
index bdba21cb..c5270ef5 100644
--- a/kamon-spray/src/main/resources/reference.conf
+++ b/kamon-spray/src/main/resources/reference.conf
@@ -36,4 +36,12 @@ kamon {
instrumentation-level = request-level
}
}
+
+ modules {
+ kamon-spray {
+ auto-start = yes
+ requires-aspectj = yes
+ extension-id = "kamon.spray.Spray"
+ }
+ }
} \ No newline at end of file
diff --git a/kamon-statsd/src/main/resources/reference.conf b/kamon-statsd/src/main/resources/reference.conf
index 1e2729dd..f26ce98b 100644
--- a/kamon-statsd/src/main/resources/reference.conf
+++ b/kamon-statsd/src/main/resources/reference.conf
@@ -62,4 +62,12 @@ kamon {
metric-name-normalization-strategy = normalize
}
}
+
+ modules {
+ kamon-statsd {
+ auto-start = yes
+ requires-aspectj = no
+ extension-id = "kamon.statsd.StatsD"
+ }
+ }
} \ No newline at end of file
diff --git a/kamon-system-metrics/src/main/resources/reference.conf b/kamon-system-metrics/src/main/resources/reference.conf
index 7f65e477..57b34195 100644
--- a/kamon-system-metrics/src/main/resources/reference.conf
+++ b/kamon-system-metrics/src/main/resources/reference.conf
@@ -178,4 +178,12 @@ kamon {
}
}
+
+ modules {
+ kamon-system-metrics {
+ auto-start = yes
+ requires-aspectj = no
+ extension-id = "kamon.system.SystemMetrics"
+ }
+ }
} \ No newline at end of file
diff --git a/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsExtension.scala b/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsExtension.scala
index df120611..8a27dd03 100644
--- a/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsExtension.scala
+++ b/kamon-system-metrics/src/main/scala/kamon/system/SystemMetricsExtension.scala
@@ -18,9 +18,10 @@ package kamon.system
import java.io.File
import akka.actor._
import akka.event.Logging
+import kamon.supervisor.ModuleSupervisor
import kamon.system.custom.{ ContextSwitchesUpdater, ContextSwitchesMetrics }
import kamon.system.jmx._
-import kamon.{ ModuleSupervisor, Kamon }
+import kamon.Kamon
import kamon.metric._
import kamon.sigar.SigarProvisioner
import kamon.system.sigar.SigarMetricsUpdater