我正面临着 kamon 集成的这个问题。尝试了各种其他方法仍然无法解决此问题。我有一个在这些配置上运行的示例项目。我一定错过了一些非常简单的东西。
插件.sbt
import sbt.Resolver
resolvers ++= Seq(
Resolver.bintrayIvyRepo("kamon-io", "sbt-plugins")
)
addSbtPlugin("io.kamon" % "sbt-aspectj-play-runner-26" % "1.0.4")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.7")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.1.6")
构建.sbt
import sbt.Keys.libraryDependencies
name := """event-publication-service"""
organization := "com.nice.incontact"
version := "1.0-SNAPSHOT"
val resolutionRepos = Seq("Kamon Repository Snapshots" at "http://snapshots.kamon.io")
val kamonVersion = "0.6.7"
val dependencies = Seq(
"io.kamon" %% "kamon-core" % kamonVersion,
"io.kamon" %% "kamon-jmx" % kamonVersion,
"io.kamon" %% "kamon-akka-2.5" % kamonVersion,
// "io.kamon" %% "kamon-play-26" % kamonVersion,
"io.kamon" %% "kamon-akka-http" % kamonVersion,
"io.kamon" %% "kamon-datadog" % kamonVersion
)
lazy val root = (project in file(".")).enablePlugins(PlayScala, LauncherJarPlugin, JavaAppPackaging, DockerPlugin)
.settings(resolvers ++= resolutionRepos)
.settings(libraryDependencies ++= dependencies)
scalaVersion := "2.12.3"
libraryDependencies += guice
libraryDependencies += "com.pauldijou" %% "jwt-play-json" % "0.14.1"
libraryDependencies += "com.amazonaws" % "amazon-kinesis-client" % "1.8.1" % Compile
libraryDependencies += "com.fasterxml.jackson.dataformat" % "jackson-dataformat-cbor" % "2.8.10" % Compile
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3" % Test
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.5.0" % Compile
libraryDependencies += "com.fasterxml.uuid" % "java-uuid-generator" % "3.1.4" % Compile
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test
libraryDependencies += "com.typesafe.akka" % "akka-testkit_2.12" % "2.5.6" % Test
libraryDependencies += "org.pegdown" % "pegdown" % "1.6.0" % Test
libraryDependencies += "org.mockito" % "mockito-core" % "2.7.15" % Test
libraryDependencies += "org.aspectj" % "aspectjweaver" % "1.8.6"
fork in run := true
//kamon.aspectj.sbt.AspectjRunner.testSettings
javaOptions in Test += "-Dconfig.file=conf/application-test.conf"
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-h", "TestReports")
coverageEnabled := true
coverageMinimum := 85
coverageFailOnMinimum := true
coverageExcludedPackages := "<empty>;.*javascript.*;Reverse.*;router.*"
coverageExcludedFiles := "Reverse*"
packageName in Docker := packageName.value
maintainer in Docker := "Partner Integration Team"
dockerBaseImage := "java:8-jre"
dockerExposedPorts := Seq(9443)
dockerExposedVolumes := Seq("/opt/docker/logs")
dockerEntrypoint := Seq("bin/event-publication-service", "-Dconfig.file=conf/application-prod.conf", "-Dhttps.port=9443", "-Dhttp.port=disabled")
开机启动
[info] Updating {file:/D:/Sprint2/PubSubService/IC2287/}root...
[info] Done updating.
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn] * io.netty:netty-handler:4.0.43.Final is selected over 4.0.41.Final
[warn] +- io.netty:netty-codec-http:4.0.43.Final (depends on 4.0.43.Final)
[warn] +- com.typesafe.netty:netty-reactive-streams:1.0.8 (depends on 4.0.41.Final)
[warn] * com.google.guava:guava:22.0 is selected over {18.0, 19.0}
[warn] +- com.typesafe.play:play_2.12:2.6.7 (depends on 22.0)
[warn] +- com.google.inject:guice:4.1.0 (depends on 19.0)
[warn] +- com.amazonaws:amazon-kinesis-client:1.8.1 (depends on 18.0)
[warn] * com.typesafe.akka:akka-stream_2.12:2.5.6 is selected over 2.4.19
[warn] +- com.typesafe.play:play-streams_2.12:2.6.7 (depends on 2.5.6)
[warn] +- com.typesafe.akka:akka-http-core_2.12:10.0.10 (depends on 2.4.19)
[warn] * com.typesafe.akka:akka-actor_2.12:2.5.6 is selected over {2.5.2, 2.4.14, 2.4.19}
[warn] +- com.typesafe.akka:akka-stream_2.12:2.5.6 () (depends on 2.5.6)
[warn] +- com.typesafe.play:play_2.12:2.6.7 (depends on 2.5.6)
[warn] +- com.typesafe.akka:akka-slf4j_2.12:2.5.6 () (depends on 2.5.6)
[warn] +- com.typesafe.akka:akka-parsing_2.12:10.0.10 (depends on 2.4.19)
[warn] +- io.kamon:kamon-jmx_2.12:0.6.7 (depends on 2.4.14)
[warn] +- io.kamon:kamon-core_2.12:0.6.7 (depends on 2.4.14)
[warn] +- io.kamon:kamon-datadog_2.12:0.6.7 (depends on 2.4.14)
[warn] +- io.kamon:kamon-akka-2.4_2.12:0.6.6 (depends on 2.4.14)
[warn] +- io.kamon:kamon-akka-2.5_2.12:0.6.7 (depends on 2.5.2)
[warn] * org.scala-lang.modules:scala-java8-compat_2.12:0.8.0 is selected over 0.5.0
[warn] +- com.typesafe.akka:akka-actor_2.12:2.5.6 () (depends on 0.8.0)
[warn] +- com.typesafe.play:play-streams_2.12:2.6.7 (depends on 0.8.0)
[warn] +- com.typesafe.play:play_2.12:2.6.7 (depends on 0.8.0)
[warn] +- io.kamon:kamon-datadog_2.12:0.6.7 (depends on 0.5.0)
[warn] Run 'evicted' to see detailed eviction warnings
[info] Running the application with Aspectj Weaver
--- (Running the application, auto-reloading is enabled) ---
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Enter to stop and go back to the console...)
[info] Compiling 29 Scala sources and 2 Java sources to D:\Sprint2\PubSubService\IC2287\target\scala-2.12\classes ...
[info] [info] Cleaning datadir [D:\Sprint2\PubSubService\IC2287\target\scala-2.12/scoverage-data]
[info] [info] Beginning coverage instrumentation
[info] [info] Instrumentation completed [1215 statements]
[info] [info] Wrote instrumentation file [D:\Sprint2\PubSubService\IC2287\target\scala-2.12\scoverage-data\scoverage.coverage.xml]
[info] [info] Will write measurement data to [D:\Sprint2\PubSubService\IC2287\target\scala-2.12/scoverage-data]
[warn] there were two feature warnings; re-run with -feature for details
[warn] one warning found
[info] Done compiling.
[info] c.n.i.Application - Initiating configurations
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] c.n.i.s.PubSubSupervisor - Supervisor is started
[info] c.n.i.p.a.EventRouter - EventRouter Actor is created
[info] c.n.i.u.ApplicationUtil - Checking for keys.
[info] c.n.i.t.a.TransformerActor - Transformer created.
[info] c.a.s.k.c.c.KinesisClientLibConfigurator - Value of workerId is not provided in the properties. WorkerId is automatically assigned as: 4905dbb1-2711-40c4-839c-3140086cea44
[info] c.a.s.k.c.c.KinesisClientLibConfigurator - Successfully set property initialPositionInStream with value TRIM_HORIZON
[info] c.n.i.c.KinesisConsumer -
-----------------------------------------------------------------------
-------------------- Initialising Kinesis Consumer --------------------
-----------------------------------------------------------------------
***** Running event-publication-service-dipjyoti_akka_test *****
***** Processing Stream: dipjyoti_akka_test *****
***** WorkerId: 4905dbb1-2711-40c4-839c-3140086cea44 *****
-----------------------------------------------------------------------
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] k.Kamon$Instance - Initializing Kamon...
[INFO] [01/05/2018 14:22:06.851] [PubSubSystem-akka.actor.default-dispatcher-3] [DatadogExtension(akka://kamon)] Starting the Kamon(Datadog) extension
[error] k.ModuleLoaderExtension -
___ _ ___ _ _ ___ ___ _ _
/ _ \ | | |_ | | | | | | \/ |(_) (_)
/ /_\ \ ___ _ __ ___ ___ | |_ | | | | | | ___ __ _ __ __ ___ _ __ | . . | _ ___ ___ _ _ __ __ _
| _ |/ __|| '_ \ / _ \ / __|| __| | | | |/\| | / _ \ / _` |\ \ / // _ \| '__| | |\/| || |/ __|/ __|| || '_ \ / _` |
| | | |\__ \| |_) || __/| (__ | |_ /\__/ / \ /\ /| __/| (_| | \ 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 AspectJ to work properly:
kamon-akka, kamon-akka-http, kamon-scala
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.show-aspectj-missing-warning setting in your configuration file.
[info] c.a.s.k.l.i.LeaseCoordinator - With failover time 10000 ms and epsilon 25 ms, LeaseCoordinator will renew leases every 3308 ms, takeleases every 20050 ms, process maximum of 2147483647 leases and steal 1 lease(s) at a time.
[info] c.a.s.k.c.l.w.Worker - Initialization attempt 1
[info] c.a.s.k.c.l.w.Worker - Initializing LeaseCoordinator
[INFO] [01/05/2018 14:22:06.992] [PubSubSystem-akka.actor.default-dispatcher-3] [JMXExtension(akka://kamon)] Starting the Kamon(JMX) extension
[info] p.a.h.EnabledFilters - Enabled Filters (see <https://www.playframework.com/documentation/latest/Filters>):
play.filters.csrf.CSRFFilter
play.filters.headers.SecurityHeadersFilter
play.filters.hosts.AllowedHostsFilter
play.filters.hosts.AllowedHostsFilter
[info] play.api.Play - Application started (Dev)[info] Updating {file:/D:/Sprint2/PubSubService/IC2287/}root...
[info] Done updating.
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn] * io.netty:netty-handler:4.0.43.Final is selected over 4.0.41.Final
[warn] +- io.netty:netty-codec-http:4.0.43.Final (depends on 4.0.43.Final)
[warn] +- com.typesafe.netty:netty-reactive-streams:1.0.8 (depends on 4.0.41.Final)
[warn] * com.google.guava:guava:22.0 is selected over {18.0, 19.0}
[warn] +- com.typesafe.play:play_2.12:2.6.7 (depends on 22.0)
[warn] +- com.google.inject:guice:4.1.0 (depends on 19.0)
[warn] +- com.amazonaws:amazon-kinesis-client:1.8.1 (depends on 18.0)
[warn] * com.typesafe.akka:akka-stream_2.12:2.5.6 is selected over 2.4.19
[warn] +- com.typesafe.play:play-streams_2.12:2.6.7 (depends on 2.5.6)
[warn] +- com.typesafe.akka:akka-http-core_2.12:10.0.10 (depends on 2.4.19)
[warn] * com.typesafe.akka:akka-actor_2.12:2.5.6 is selected over {2.5.2, 2.4.14, 2.4.19}
[warn] +- com.typesafe.akka:akka-stream_2.12:2.5.6 () (depends on 2.5.6)
[warn] +- com.typesafe.play:play_2.12:2.6.7 (depends on 2.5.6)
[warn] +- com.typesafe.akka:akka-slf4j_2.12:2.5.6 () (depends on 2.5.6)
[warn] +- com.typesafe.akka:akka-parsing_2.12:10.0.10 (depends on 2.4.19)
[warn] +- io.kamon:kamon-jmx_2.12:0.6.7 (depends on 2.4.14)
[warn] +- io.kamon:kamon-core_2.12:0.6.7 (depends on 2.4.14)
[warn] +- io.kamon:kamon-datadog_2.12:0.6.7 (depends on 2.4.14)
[warn] +- io.kamon:kamon-akka-2.4_2.12:0.6.6 (depends on 2.4.14)
[warn] +- io.kamon:kamon-akka-2.5_2.12:0.6.7 (depends on 2.5.2)
[warn] * org.scala-lang.modules:scala-java8-compat_2.12:0.8.0 is selected over 0.5.0
[warn] +- com.typesafe.akka:akka-actor_2.12:2.5.6 () (depends on 0.8.0)
[warn] +- com.typesafe.play:play-streams_2.12:2.6.7 (depends on 0.8.0)
[warn] +- com.typesafe.play:play_2.12:2.6.7 (depends on 0.8.0)
[warn] +- io.kamon:kamon-datadog_2.12:0.6.7 (depends on 0.5.0)
[warn] Run 'evicted' to see detailed eviction warnings
[info] Running the application with Aspectj Weaver
--- (Running the application, auto-reloading is enabled) ---
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Enter to stop and go back to the console...)
[info] Compiling 29 Scala sources and 2 Java sources to D:\Sprint2\PubSubService\IC2287\target\scala-2.12\classes ...
[info] [info] Cleaning datadir [D:\Sprint2\PubSubService\IC2287\target\scala-2.12/scoverage-data]
[info] [info] Beginning coverage instrumentation
[info] [info] Instrumentation completed [1215 statements]
[info] [info] Wrote instrumentation file [D:\Sprint2\PubSubService\IC2287\target\scala-2.12\scoverage-data\scoverage.coverage.xml]
[info] [info] Will write measurement data to [D:\Sprint2\PubSubService\IC2287\target\scala-2.12/scoverage-data]
[warn] there were two feature warnings; re-run with -feature for details
[warn] one warning found
[info] Done compiling.
[info] c.n.i.Application - Initiating configurations
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] c.n.i.s.PubSubSupervisor - Supervisor is started
[info] c.n.i.p.a.EventRouter - EventRouter Actor is created
[info] c.n.i.u.ApplicationUtil - Checking for keys.
[info] c.n.i.t.a.TransformerActor - Transformer created.
[info] c.a.s.k.c.c.KinesisClientLibConfigurator - Value of workerId is not provided in the properties. WorkerId is automatically assigned as: 4905dbb1-2711-40c4-839c-3140086cea44
[info] c.a.s.k.c.c.KinesisClientLibConfigurator - Successfully set property initialPositionInStream with value TRIM_HORIZON
[info] c.n.i.c.KinesisConsumer -
-----------------------------------------------------------------------
-------------------- Initialising Kinesis Consumer --------------------
-----------------------------------------------------------------------
***** Running event-publication-service-dipjyoti_akka_test *****
***** Processing Stream: dipjyoti_akka_test *****
***** WorkerId: 4905dbb1-2711-40c4-839c-3140086cea44 *****
-----------------------------------------------------------------------
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] k.Kamon$Instance - Initializing Kamon...
[INFO] [01/05/2018 14:22:06.851] [PubSubSystem-akka.actor.default-dispatcher-3] [DatadogExtension(akka://kamon)] Starting the Kamon(Datadog) extension
[error] k.ModuleLoaderExtension -
___ _ ___ _ _ ___ ___ _ _
/ _ \ | | |_ | | | | | | \/ |(_) (_)
/ /_\ \ ___ _ __ ___ ___ | |_ | | | | | | ___ __ _ __ __ ___ _ __ | . . | _ ___ ___ _ _ __ __ _
| _ |/ __|| '_ \ / _ \ / __|| __| | | | |/\| | / _ \ / _` |\ \ / // _ \| '__| | |\/| || |/ __|/ __|| || '_ \ / _` |
| | | |\__ \| |_) || __/| (__ | |_ /\__/ / \ /\ /| __/| (_| | \ 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 AspectJ to work properly:
kamon-akka, kamon-akka-http, kamon-scala
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.show-aspectj-missing-warning setting in your configuration file.
[info] c.a.s.k.l.i.LeaseCoordinator - With failover time 10000 ms and epsilon 25 ms, LeaseCoordinator will renew leases every 3308 ms, takeleases every 20050 ms, process maximum of 2147483647 leases and steal 1 lease(s) at a time.
[info] c.a.s.k.c.l.w.Worker - Initialization attempt 1
[info] c.a.s.k.c.l.w.Worker - Initializing LeaseCoordinator
[INFO] [01/05/2018 14:22:06.992] [PubSubSystem-akka.actor.default-dispatcher-3] [JMXExtension(akka://kamon)] Starting the Kamon(JMX) extension
[info] p.a.h.EnabledFilters - Enabled Filters (see <https://www.playframework.com/documentation/latest/Filters>):
play.filters.csrf.CSRFFilter
play.filters.headers.SecurityHeadersFilter
play.filters.hosts.AllowedHostsFilter
play.filters.hosts.AllowedHostsFilter
[info] play.api.Play - Application started (Dev)