Error when disabling auto-start of a module
This error occurred when i defined the system property kamon.modules.kamon-newrelic.auto-start=false and the kamon-newrelic jar wasn't on the classpath:
Cause: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'extension-id' at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:124) at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:145) at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:159) at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:164) at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:206) at kamon.ModuleLoaderSettings$$anonfun$5.apply(ModuleLoader.scala:104) at kamon.ModuleLoaderSettings$$anonfun$5.apply(ModuleLoader.scala:99) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245) at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245) at scala.collection.immutable.Set$Set1.foreach(Set.scala:79)
This is Kamon-0.5.1
Hey @cheekychops! The problem here is that Kamon always expects that any key under kamon.modules.* will have all "module definition" keys on it, as shown here: https://github.com/kamon-io/Kamon/blob/master/kamon-newrelic/src/main/resources/reference.conf#L42
We wanted people to be able to add reporters mostly by just adding the dependency to the classpath and configuring whatever that is necessary, but with no code changes if possible and for that we rely on the typesafe-config way of merging reference.conf files. So, please, ensure that the given module is in the classpath (btw, why wasn't it?) or if you have good reasons for it to be missing, then add the aforementioned module config lines to your application.conf file and it should not complain anymore.
Hey @ivantopo, i kind of have similar case where i want to have some modules disabled, let's say for production mode
if i just remove dependency this will do, but if somehow it gets in classpath, then it will be started automatically, which i want to prevent with just
kamon.modules.log-reporter.auto-start = no in my config file.
As far as i understand, an easy fix would be to do
val availableModules = modules.flatMap { moduleName ⇒
val moduleConfig = config.getConfig(moduleName)
if (moduleConfig.getBoolean("auto-start"))
Some(AvailableModuleInfo(
moduleName,
moduleConfig.getString("extension-id"),
moduleConfig.getBoolean("requires-aspectj")
))
else None
} toList
instead of
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
if this is okay, i can send a PR
hey @jozic! The thing here is that the requires-aspectj has to be present for every module we have because that is what feeds the "AspectJ Weaver missing warning" thing that we have upon Kamon's startup. As a example, the kamon-scala module requires aspectj, but it does not have anything to be started so auto-start is false and extension-id is irrelevant for that module, but still we at least check auto-start and requires-aspectj for it, as we do with every single module.
As a side note, I'm working on a few changes in the way we create and start modules which probably will make this discussion oudated.. so, give me a few days to think about it in more detail and then we can get back to this.
sure, take your time
my understanding was that extension can be in classpath, but by setting auto-start to false you can disable it fully (no instrumentation happens by any means). And if i disable it, chances are i don't care about aspectj warning for this extension any more. Other extensions which require iaspectj will issue the warning. If no other extensions need it, still good, as i disabled the only one that required aspectj
Anyway, as far as i understand you going to change this whole system, so sure we can wait and it's not that critical