Kamon 配置错误 'requires-aspectj'

Kamon error with configuration 'requires-aspectj'

我正在将 kamon 添加到我的独立 akka 应用程序中,但出现此错误:

com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'requires-aspectj' 错误 Kamon.start()

这是application.conf的相关内容。

{
...
  modules {
    kamon-akka {
      auto-start = no
    }
    kamon-statsd {
      auto-start = no
    }
    kamon-system-metric {
      auto-start = no
      requires-aspectj = no
      extension-id = "kamon.system.SystemMetrics"
    }
  }
}

application.conf: 36: requires-aspectj has type STRING rather than OBJECT

但是,当我包含询问时 属性

{
  modules {
    requires-aspectj = no
  ...
  }
}

我收到此错误:application.conf: 36: requires-aspectj has type STRING rather than OBJECT

如果我删除 Kamon.start() 我的应用程序将照常启动

这是我的 build.sbt:

的摘录
lazy val root = (project in file("."))
  .settings(name := "kamon-akka")
  .settings(Seq(scalaVersion := "2.11.8"))
  .settings(libraryDependencies ++= Seq(
    akka.Http,
    akka.slf4jApi,
    akka.akkaSlf4j,
    kamon.Core,
    kamon.Akka,
    kamon.LogReporter,
    kamon.SystemMetrics,
    aspectj.aspectjtools,
    aspectj.aspectjweaver,
    aspectj.aspectjrt
  ))
  .settings(aspectjSettings: _*)

PS:

有什么想法吗?

首先,您的 application.conf 看起来很奇怪,因为它似乎没有 kamon 名称空间。它应该如下所示(注意第一行):

kamon {
  ...
  modules {
    kamon-akka {
      ...
    }
    kamon-statsd {
      ...
    }
    kamon-system-metrics {
      ...
    }
  } 
}

其次,由于您使用的是 sbt-aspectj 插件,请将以下内容添加到您的 build.sbt(来源:http://kamon.io/documentation/get-started/):

import com.typesafe.sbt.SbtAspectj._

// Bring the sbt-aspectj settings into this build
aspectjSettings

// Here we are effectively adding the `-javaagent` JVM startup
// option with the location of the AspectJ Weaver provided by
// the sbt-aspectj plugin.
javaOptions in run <++= AspectjKeys.weaverOptions in Aspectj

// We need to ensure that the JVM is forked for the
// AspectJ Weaver to kick in properly and do it's magic.
fork in run := true