diff --git a/build.sbt b/build.sbt index dec77aaf0..228ff671d 100644 --- a/build.sbt +++ b/build.sbt @@ -13,13 +13,12 @@ * ========================================================================================= */ -import Tests._ - lazy val kamon = (project in file(".")) .disablePlugins(AssemblyPlugin) .settings(noPublishing: _*) .settings(crossScalaVersions := Nil) - .aggregate(core, instrumentation, reporters) + .aggregate(core, instrumentation, reporters, bundle) + lazy val core = (project in file("core")) .disablePlugins(AssemblyPlugin) @@ -27,19 +26,20 @@ lazy val core = (project in file("core")) .settings(crossScalaVersions := Nil) .aggregate(`kamon-core`, `kamon-status-page`, `kamon-testkit`, `kamon-core-tests`, `kamon-core-bench`) + lazy val `kamon-core` = (project in file("core/kamon-core")) .enablePlugins(BuildInfoPlugin) .enablePlugins(AssemblyPlugin) .settings( - name := "kamon-core", - moduleName := "kamon-core", buildInfoKeys := Seq[BuildInfoKey](version), buildInfoPackage := "kamon.status", scalacOptions ++= { if(scalaBinaryVersion.value == "2.11") Seq("-Ydelambdafy:method") else Seq.empty }, assemblyShadeRules in assembly := Seq( - ShadeRule.rename("org.jctools.**" -> "kamon.lib.@0").inAll, - ShadeRule.rename("org.HdrHistogram.ZigZag" -> "@0").inAll, - ShadeRule.rename("org.HdrHistogram.**" -> "kamon.lib.@0").inAll, + ShadeRule.rename("org.jctools.**" -> "kamon.lib.@0").inAll, + ShadeRule.rename("org.HdrHistogram.Base*" -> "@0").inAll, + ShadeRule.rename("org.HdrHistogram.HdrHistogramInternalState" -> "@0").inAll, + ShadeRule.rename("org.HdrHistogram.ZigZag" -> "@0").inAll, + ShadeRule.rename("org.HdrHistogram.*" -> "org.HdrHistogram.Shaded@1").inAll, ShadeRule.keep( "kamon.Kamon", "kamon.context.**", @@ -56,8 +56,8 @@ lazy val `kamon-core` = (project in file("core/kamon-core")) libraryDependencies ++= Seq( "com.typesafe" % "config" % "1.3.1", "org.slf4j" % "slf4j-api" % "1.7.25", - "org.hdrhistogram" % "HdrHistogram" % "2.1.9" % "shaded", - "org.jctools" % "jctools-core" % "2.1.1" % "shaded", + "org.hdrhistogram" % "HdrHistogram" % "2.1.9" % "provided,shaded", + "org.jctools" % "jctools-core" % "2.1.1" % "provided,shaded", ), ) @@ -65,26 +65,21 @@ lazy val `kamon-core` = (project in file("core/kamon-core")) lazy val `kamon-status-page` = (project in file("core/kamon-status-page")) .enablePlugins(AssemblyPlugin) .settings( - name := "kamon-status-page", - moduleName := "kamon-status-page", assemblyShadeRules in assembly := Seq( ShadeRule.rename("com.grack.nanojson.**" -> "kamon.lib.@0").inAll, ShadeRule.rename("fi.iki.elonen.**" -> "kamon.lib.@0").inAll, ), libraryDependencies ++= Seq( - "org.nanohttpd" % "nanohttpd" % "2.3.1" % "shaded", - "com.grack" % "nanojson" % "1.1" % "shaded" + "com.grack" % "nanojson" % "1.1" % "provided,shaded", + "org.nanohttpd" % "nanohttpd" % "2.3.1" % "provided,shaded" ) - ).dependsOn(`kamon-core` % "provided") + ).dependsOn(`kamon-core`) lazy val `kamon-testkit` = (project in file("core/kamon-testkit")) .disablePlugins(AssemblyPlugin) .settings( - moduleName := "kamon-testkit", - libraryDependencies ++= Seq( - "org.scalatest" %% "scalatest" % "3.0.8" % "test" - ) + libraryDependencies += scalatest % "test" ).dependsOn(`kamon-core`) @@ -92,10 +87,9 @@ lazy val `kamon-core-tests` = (project in file("core/kamon-core-tests")) .disablePlugins(AssemblyPlugin) .settings(noPublishing: _*) .settings( - moduleName := "kamon-core-tests", libraryDependencies ++= Seq( - "org.scalatest" %% "scalatest" % "3.0.8" % "test", - "ch.qos.logback" % "logback-classic" % "1.2.3" % "test" + scalatest % "test", + logbackClassic % "test" ) ).dependsOn(`kamon-testkit`) @@ -103,7 +97,6 @@ lazy val `kamon-core-tests` = (project in file("core/kamon-core-tests")) lazy val `kamon-core-bench` = (project in file("core/kamon-core-bench")) .disablePlugins(AssemblyPlugin) .enablePlugins(JmhPlugin) - .settings(moduleName := "kamon-core-bench") .settings(noPublishing: _*) .dependsOn(`kamon-core`) @@ -135,29 +128,30 @@ lazy val instrumentation = (project in file("instrumentation")) `kamon-play` ) + lazy val `kamon-instrumentation-common` = (project in file("instrumentation/kamon-instrumentation-common")) .disablePlugins(AssemblyPlugin) .enablePlugins(JavaAgent) .settings(instrumentationSettings) .settings( - name := "kamon-instrumentation-common", - moduleName := "kamon-instrumentation-common", resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - scalatest % "test", slf4jApi % "test", + scalatest % "test", kanelaAgent % "provided" ) ).dependsOn(`kamon-core`, `kamon-testkit` % "test") + lazy val `kamon-executors` = (project in file("instrumentation/kamon-executors")) .disablePlugins(AssemblyPlugin) .settings( - moduleName := "kamon-executors", - testGrouping in Test := groupByExperimentalExecutorTests((definedTests in Test).value, kanelaAgentJar.value), - libraryDependencies ++= - providedScope(kanelaAgent) ++ - testScope(scalatest, logbackClassic, "com.google.guava" % "guava" % "24.1-jre") + libraryDependencies ++= Seq( + kanelaAgent % "provided", + scalatest % "test", + logbackClassic % "test", + "com.google.guava" % "guava" % "24.1-jre" % "test", + ) ).dependsOn(`kamon-core`, `kamon-instrumentation-common`, `kamon-testkit` % "test") lazy val `kamon-executors-bench` = (project in file("instrumentation/kamon-executors-bench")) @@ -165,58 +159,40 @@ lazy val `kamon-executors-bench` = (project in file("instrumentation/kamon-execu .enablePlugins(JmhPlugin) .settings(noPublishing: _*) .settings( - moduleName := "kamon-executors-bench", - resolvers += Resolver.mavenLocal, - libraryDependencies ++= compileScope(kanelaAgent, "com.google.guava" % "guava" % "24.1-jre") + libraryDependencies ++= Seq( + "com.google.guava" % "guava" % "24.1-jre", + kanelaAgent % "provided", + ) ).dependsOn(`kamon-core`, `kamon-instrumentation-common`) -def groupByExperimentalExecutorTests(tests: Seq[TestDefinition], kanelaJar: File): Seq[Group] = { - val (stable, experimental) = tests.partition(t => t.name != "kamon.instrumentation.executor.CaptureContextOnSubmitInstrumentationSpec") - - val stableGroup = Group("stableTests", stable, SubProcess( - ForkOptions().withRunJVMOptions(Vector( - "-javaagent:" + kanelaJar.toString - )) - )) - - val experimentalGroup = Group("experimentalTests", experimental, SubProcess( - ForkOptions().withRunJVMOptions(Vector( - "-javaagent:" + kanelaJar.toString, - "-Dkanela.modules.executor-service.enabled=false", - "-Dkanela.modules.executor-service-capture-on-submit.enabled=true" - )) - )) - - Seq(stableGroup, experimentalGroup) -} - -val twitterUtilCore = "com.twitter" %% "util-core" % "6.40.0" -val scalazConcurrent = "org.scalaz" %% "scalaz-concurrent" % "7.2.28" -val catsEffect = "org.typelevel" %% "cats-effect" % "1.2.0" - lazy val `kamon-twitter-future` = (project in file("instrumentation/kamon-twitter-future")) .disablePlugins(AssemblyPlugin) .enablePlugins(JavaAgent) .settings(instrumentationSettings) .settings( - scalaVersion := "2.12.10", bintrayPackage := "kamon-futures", - crossScalaVersions := Seq("2.11.12", "2.12.10"), - libraryDependencies ++= - providedScope(kanelaAgent, twitterUtilCore) ++ - testScope(scalatest, logbackClassic) + libraryDependencies ++= Seq( + kanelaAgent % "provided", + "com.twitter" %% "util-core" % "20.3.0" % "provided", + scalatest % "test", + logbackClassic % "test" + ) ).dependsOn(`kamon-core`, `kamon-executors`, `kamon-testkit` % "test") + lazy val `kamon-scalaz-future` = (project in file("instrumentation/kamon-scalaz-future")) .disablePlugins(AssemblyPlugin) .enablePlugins(JavaAgent) .settings(instrumentationSettings) .settings( bintrayPackage := "kamon-futures", - libraryDependencies ++= - providedScope(kanelaAgent, scalazConcurrent) ++ - testScope(scalatest, logbackClassic) + libraryDependencies ++= Seq( + kanelaAgent % "provided", + "org.scalaz" %% "scalaz-concurrent" % "7.2.28" % "provided", + scalatest % "test", + logbackClassic % "test" + ) ).dependsOn(`kamon-core`, `kamon-executors`, `kamon-testkit` % "test") lazy val `kamon-scala-future` = (project in file("instrumentation/kamon-scala-future")) @@ -225,9 +201,11 @@ lazy val `kamon-scala-future` = (project in file("instrumentation/kamon-scala-fu .settings(instrumentationSettings) .settings( bintrayPackage := "kamon-futures", - libraryDependencies ++= - providedScope(kanelaAgent) ++ - testScope(scalatest, logbackClassic) + libraryDependencies ++=Seq( + kanelaAgent % "provided", + scalatest % "test", + logbackClassic % "test" + ) ).dependsOn(`kamon-core`, `kamon-executors`, `kamon-testkit` % "test") lazy val `kamon-cats-io` = (project in file("instrumentation/kamon-cats-io")) @@ -235,12 +213,19 @@ lazy val `kamon-cats-io` = (project in file("instrumentation/kamon-cats-io")) .enablePlugins(JavaAgent) .settings(instrumentationSettings) .settings( - scalaVersion := "2.12.10", bintrayPackage := "kamon-futures", - crossScalaVersions := Seq("2.11.12", "2.12.10"), - libraryDependencies ++= - providedScope(catsEffect, kanelaAgent) ++ - testScope(scalatest, logbackClassic) + libraryDependencies ++= Seq( + kanelaAgent % "provided", + { + if(scalaBinaryVersion.value == "2.11") + "org.typelevel" %% "cats-effect" % "2.0.0" % "provided" + else + "org.typelevel" %% "cats-effect" % "2.1.2" % "provided" + }, + scalatest % "test", + logbackClassic % "test" + ), + ).dependsOn(`kamon-core`, `kamon-executors`, `kamon-testkit` % "test") @@ -249,126 +234,133 @@ lazy val `kamon-logback` = (project in file("instrumentation/kamon-logback")) .enablePlugins(JavaAgent) .settings(instrumentationSettings) .settings( - moduleName := "kamon-logback", - libraryDependencies ++= - providedScope(kanelaAgent, "ch.qos.logback" % "logback-classic" % "1.2.3") ++ - testScope(scalatest) + libraryDependencies ++= Seq( + kanelaAgent % "provided", + logbackClassic % "provided", + scalatest % "test", + ) ).dependsOn(`kamon-core`, `kamon-instrumentation-common`, `kamon-testkit` % "test") -val slick = "com.typesafe.slick" %% "slick" % "3.3.2" -val slickHikari = "com.typesafe.slick" %% "slick-hikaricp" % "3.3.2" -val h2 = "com.h2database" % "h2" % "1.4.182" -val sqlite = "org.xerial" % "sqlite-jdbc" % "3.27.2.1" -val mariaConnector = "org.mariadb.jdbc" % "mariadb-java-client" % "2.2.6" -val mariaDB4j = "ch.vorburger.mariaDB4j" % "mariaDB4j" % "2.4.0" -val postgres = "org.postgresql" % "postgresql" % "42.2.5" -val hikariCP = "com.zaxxer" % "HikariCP" % "2.6.2" lazy val `kamon-jdbc` = (project in file("instrumentation/kamon-jdbc")) .disablePlugins(AssemblyPlugin) .enablePlugins(JavaAgent) .settings(instrumentationSettings) .settings( - moduleName := "kamon-jdbc", - libraryDependencies ++= - providedScope(kanelaAgent, hikariCP, mariaConnector, slick, postgres) ++ - testScope(h2, sqlite, mariaDB4j, postgres, slickHikari, scalatest, slf4jApi, logbackClassic) + libraryDependencies ++= Seq( + kanelaAgent % "provided", + "com.zaxxer" % "HikariCP" % "2.6.2" % "provided", + "org.mariadb.jdbc" % "mariadb-java-client" % "2.2.6" % "provided", + "com.typesafe.slick" %% "slick" % "3.3.2" % "provided", + "org.postgresql" % "postgresql" % "42.2.5" % "provided", + + scalatest % "test", + logbackClassic % "test", + "com.typesafe.slick" %% "slick-hikaricp" % "3.3.2" % "test", + "com.h2database" % "h2" % "1.4.182" % "test", + "org.xerial" % "sqlite-jdbc" % "3.27.2.1" % "test", + "ch.vorburger.mariaDB4j" % "mariaDB4j" % "2.4.0" % "test" + ) ).dependsOn(`kamon-core`, `kamon-executors`, `kamon-testkit` % "test") -val mongoSyncDriver = "org.mongodb" % "mongodb-driver-sync" % "3.11.0" -val mongoScalaDriver = "org.mongodb.scala" %% "mongo-scala-driver" % "2.7.0" -val mongoDriver = "org.mongodb" % "mongodb-driver-reactivestreams" % "1.12.0" -val embeddedMongo = "de.flapdoodle.embed" % "de.flapdoodle.embed.mongo" % "2.2.0" lazy val `kamon-mongo` = (project in file("instrumentation/kamon-mongo")) .disablePlugins(AssemblyPlugin) .enablePlugins(JavaAgent) .settings(instrumentationSettings) .settings( - moduleName := "kamon-mongo", - libraryDependencies ++= - providedScope(kanelaAgent, mongoDriver, mongoSyncDriver, mongoScalaDriver) ++ - testScope(embeddedMongo, scalatest) + libraryDependencies ++= Seq( + kanelaAgent % "provided", + "org.mongodb" % "mongodb-driver-sync" % "3.11.0" % "provided", + "org.mongodb.scala" %% "mongo-scala-driver" % "2.7.0" % "provided", + "org.mongodb" % "mongodb-driver-reactivestreams" % "1.12.0" % "provided", + + scalatest % "test", + logbackClassic % "test", + "de.flapdoodle.embed" % "de.flapdoodle.embed.mongo" % "2.2.0" % "test" + ) ).dependsOn(`kamon-core`, `kamon-instrumentation-common`, `kamon-testkit` % "test") lazy val `kamon-annotation-api` = (project in file("instrumentation/kamon-annotation-api")) .disablePlugins(AssemblyPlugin) .settings( - moduleName := "kamon-annotation-api", - resolvers += Resolver.mavenLocal, crossPaths := false, autoScalaLibrary := false, publishMavenStyle := true, javacOptions in (Compile, doc) := Seq("-Xdoclint:none") ) + lazy val `kamon-annotation` = (project in file("instrumentation/kamon-annotation")) .enablePlugins(JavaAgent) .enablePlugins(AssemblyPlugin) .settings(instrumentationSettings: _*) .settings( - moduleName := "kamon-annotation", assemblyShadeRules in assembly := Seq( ShadeRule.rename("javax.el.**" -> "kamon.lib.@0").inAll, - ShadeRule.rename("com.sun.el.**" -> "kamon.lib.@0").inAll, + ShadeRule.rename("com.sun.el.**" -> "kamon.lib.@0").inAll, ), - libraryDependencies ++= - Seq("org.glassfish" % "javax.el" % "3.0.1-b11" % "shaded") ++ - providedScope(kanelaAgent) ++ - testScope(scalatest, logbackClassic) + libraryDependencies ++= Seq( + kanelaAgent % "provided", + "org.glassfish" % "javax.el" % "3.0.1-b11" % "provided,shaded", + scalatest % "test", + logbackClassic % "test", + ) ).dependsOn(`kamon-core`, `kamon-annotation-api`, `kamon-testkit` % "test") + lazy val `kamon-system-metrics` = (project in file("instrumentation/kamon-system-metrics")) .disablePlugins(AssemblyPlugin) .settings(instrumentationSettings: _*) .settings( - moduleName := "kamon-system-metrics", - libraryDependencies ++= - Seq("com.github.oshi" % "oshi-core" % "4.2.1") ++ - testScope(scalatest, logbackClassic) + libraryDependencies ++= Seq( + "com.github.oshi" % "oshi-core" % "4.2.1", + scalatest % "test", + logbackClassic % "test" + ) ).dependsOn(`kamon-core`) + lazy val `kamon-akka` = (project in file("instrumentation/kamon-akka")) .enablePlugins(JavaAgent) .disablePlugins(AssemblyPlugin) .settings(instrumentationSettings: _*) - .settings( - moduleName := "kamon-akka", - ).dependsOn( + .dependsOn( `kamon-scala-future` % "compile,common,akka-2.5,akka-2.6", `kamon-testkit` % "test,test-common,test-akka-2.5,test-akka-2.6" ) -val akkaHttpJson = "de.heikoseeberger" %% "akka-http-json4s" % "1.27.0" -val json4sNative = "org.json4s" %% "json4s-native" % "3.6.7" -val http25 = "com.typesafe.akka" %% "akka-http" % "10.1.9" -val http2Support = "com.typesafe.akka" %% "akka-http2-support" % "10.1.9" -val httpTestKit25 = "com.typesafe.akka" %% "akka-http-testkit" % "10.1.9" -val stream25 = "com.typesafe.akka" %% "akka-stream" % "2.5.24" -val okHttp = "com.squareup.okhttp3" % "okhttp" % "3.14.7" - -resolvers += Resolver.bintrayRepo("hseeberger", "maven") lazy val `kamon-akka-http` = (project in file("instrumentation/kamon-akka-http")) .enablePlugins(JavaAgent) .disablePlugins(AssemblyPlugin) .settings(instrumentationSettings) .settings(Seq( - moduleName := "kamon-akka-http", + resolvers += Resolver.bintrayRepo("hseeberger", "maven"), javaAgents += "org.mortbay.jetty.alpn" % "jetty-alpn-agent" % "2.0.9" % "test", - libraryDependencies ++= - providedScope(kanelaAgent, http25, http2Support, stream25) ++ - testScope(httpTestKit25, scalatest, slf4jApi, slf4jnop, akkaHttpJson, json4sNative, okHttp) + libraryDependencies ++= Seq( + kanelaAgent % "provided", + "com.typesafe.akka" %% "akka-http" % "10.1.9" % "provided", + "com.typesafe.akka" %% "akka-http2-support" % "10.1.9" % "provided", + "com.typesafe.akka" %% "akka-stream" % "2.5.24" % "provided", + + scalatest % "test", + slf4jApi % "test", + slf4jnop % "test", + okHttp % "test", + "com.typesafe.akka" %% "akka-http-testkit" % "10.1.9" % "test", + "de.heikoseeberger" %% "akka-http-json4s" % "1.27.0" % "test", + "org.json4s" %% "json4s-native" % "3.6.7" % "test", + ) )).dependsOn(`kamon-akka`, `kamon-testkit` % "test") + lazy val `kamon-play` = (project in file("instrumentation/kamon-play")) .enablePlugins(JavaAgent) .disablePlugins(AssemblyPlugin) .settings(instrumentationSettings) - .settings( - moduleName := "kamon-play" - ).dependsOn( + .dependsOn( `kamon-akka` % "compile,test-common,test-play-2.7,test-play-2.6", `kamon-akka-http` % "compile,test-common,test-play-2.7,test-play-2.6", `kamon-testkit` % "test-common,test-play-2.7,test-play-2.6" @@ -379,9 +371,6 @@ lazy val `kamon-play` = (project in file("instrumentation/kamon-play")) * Reporters */ -val playJson = "com.typesafe.play" %% "play-json" % "2.7.4" -val okHttpMockServer = "com.squareup.okhttp3" % "mockwebserver" % "3.10.0" - lazy val reporters = (project in file("reporters")) .disablePlugins(AssemblyPlugin) .settings(noPublishing: _*) @@ -398,14 +387,23 @@ lazy val reporters = (project in file("reporters")) `kamon-zipkin`, ) + lazy val `kamon-datadog` = (project in file("reporters/kamon-datadog")) .disablePlugins(AssemblyPlugin) .settings( - libraryDependencies ++= - compileScope(okHttp, playJson) ++ - testScope(scalatest, slf4jApi, slf4jnop, okHttpMockServer), + libraryDependencies ++= Seq( + okHttp, + "com.typesafe.play" %% "play-json" % "2.7.4", + + scalatest % "test", + slf4jApi % "test", + slf4jnop % "test", + okHttpMockServer % "test" + ) + ).dependsOn(`kamon-core`, `kamon-testkit` % "test") + lazy val `kamon-apm-reporter` = (project in file("reporters/kamon-apm-reporter")) .enablePlugins(AssemblyPlugin) .settings( @@ -422,13 +420,12 @@ lazy val `kamon-apm-reporter` = (project in file("reporters/kamon-apm-reporter") ,ShadeRule.rename("google.protobuf.**" -> "kamon.apm.shaded.@0").inAll ,ShadeRule.rename("okhttp3.**" -> "kamon.apm.shaded.@0").inAll ,ShadeRule.rename("okio.**" -> "kamon.apm.shaded.@0").inAll - ,ShadeRule.rename("kamino.**" -> "kamon.apm.shaded.@0").inAll ), libraryDependencies ++= Seq( - okHttp % "shaded", scalatest % "test", - "com.google.protobuf" % "protobuf-java" % "3.8.0" % "shaded", + okHttp % "provided,shaded", + "com.google.protobuf" % "protobuf-java" % "3.8.0" % "provided,shaded", "ch.qos.logback" % "logback-classic" % "1.2.3" % "test", "org.scalatest" %% "scalatest" % "3.0.8" % "test", @@ -436,18 +433,20 @@ lazy val `kamon-apm-reporter` = (project in file("reporters/kamon-apm-reporter") "com.typesafe.akka" %% "akka-stream" % "2.5.23" % "test", "com.typesafe.akka" %% "akka-testkit" % "2.5.23" % "test" ) - ).dependsOn(`kamon-core` % "provided", `kamon-testkit` % "test") + ).dependsOn(`kamon-core`, `kamon-testkit` % "test") + lazy val `kamon-statsd` = (project in file("reporters/kamon-statsd")) + .disablePlugins(AssemblyPlugin) .settings( - name := "kamon-statsd", libraryDependencies += scalatest % Test, parallelExecution in Test := false ).dependsOn(`kamon-core`) + lazy val `kamon-zipkin` = (project in file("reporters/kamon-zipkin")) + .disablePlugins(AssemblyPlugin) .settings( - name := "kamon-zipkin", parallelExecution in Test := false, libraryDependencies ++= Seq( "io.zipkin.reporter2" % "zipkin-reporter" % "2.7.15", @@ -456,9 +455,10 @@ lazy val `kamon-zipkin` = (project in file("reporters/kamon-zipkin")) ) ).dependsOn(`kamon-core`) + lazy val `kamon-jaeger` = (project in file("reporters/kamon-jaeger")) + .disablePlugins(AssemblyPlugin) .settings( - name := "kamon-jaeger", parallelExecution in Test := false, libraryDependencies ++= Seq( "io.jaegertracing" % "jaeger-thrift" % "1.1.0", @@ -466,9 +466,10 @@ lazy val `kamon-jaeger` = (project in file("reporters/kamon-jaeger")) ) ).dependsOn(`kamon-core`) + lazy val `kamon-influxdb` = (project in file("reporters/kamon-influxdb")) + .disablePlugins(AssemblyPlugin) .settings( - name := "kamon-influxdb", libraryDependencies ++= Seq( okHttp, okHttpMockServer % "test", @@ -476,18 +477,20 @@ lazy val `kamon-influxdb` = (project in file("reporters/kamon-influxdb")) ) ).dependsOn(`kamon-core`, `kamon-testkit` % "test") + lazy val `kamon-graphite` = (project in file("reporters/kamon-graphite")) + .disablePlugins(AssemblyPlugin) .settings( - name := "kamon-graphite", libraryDependencies ++= Seq( scalatest % "test", logbackClassic % "test" ) ).dependsOn(`kamon-core`, `kamon-testkit` % "test") + lazy val `kamon-newrelic` = (project in file("reporters/kamon-newrelic")) + .disablePlugins(AssemblyPlugin) .settings( - name := "kamon-newrelic", libraryDependencies ++= Seq( "com.newrelic.telemetry" % "telemetry" % "0.4.0", "com.newrelic.telemetry" % "telemetry-http-okhttp" % "0.4.0", @@ -496,13 +499,84 @@ lazy val `kamon-newrelic` = (project in file("reporters/kamon-newrelic")) ) ).dependsOn(`kamon-core`) + lazy val `kamon-prometheus` = (project in file("reporters/kamon-prometheus")) + .disablePlugins(AssemblyPlugin) .settings( - name := "kamon-prometheus", libraryDependencies ++= Seq( okHttp, "org.nanohttpd" % "nanohttpd" % "2.3.1", scalatest % "test", logbackClassic % "test" ) - ).dependsOn(`kamon-core`, `kamon-testkit` % "test") \ No newline at end of file + ).dependsOn(`kamon-core`, `kamon-testkit` % "test") + + +lazy val bundle = (project in file("bundle")) + .disablePlugins(AssemblyPlugin) + .settings(noPublishing: _*) + .settings(crossScalaVersions := Nil) + .aggregate( + `kamon-bundle` + ) + + +import com.lightbend.sbt.javaagent.Modules +import BundleKeys._ + +val `kamon-bundle` = (project in file("bundle/kamon-bundle")) + .enablePlugins(BuildInfoPlugin) + .enablePlugins(AssemblyPlugin) + .settings( + moduleName := "kamon-bundle", + kanelaAgentVersion := "1.0.4", + buildInfoPackage := "kamon.bundle", + buildInfoKeys := Seq[BuildInfoKey](kanelaAgentJarName), + kanelaAgentJar := update.value.matching(Modules.exactFilter(kanelaAgent)).head, + kanelaAgentJarName := kanelaAgentJar.value.getName, + resourceGenerators in Compile += Def.task(Seq(kanelaAgentJar.value)).taskValue, + libraryDependencies ++= Seq( + "com.github.oshi" % "oshi-core" % "4.2.1", + kanelaAgent % "provided", + "net.bytebuddy" % "byte-buddy-agent" % "1.9.12" % "provided,shaded", + ), + fullClasspath in assembly ++= (internalDependencyClasspath in Shaded).value, + assemblyShadeRules in assembly := Seq( + ShadeRule.zap("**module-info").inAll, + ShadeRule.rename("net.bytebuddy.agent.**" -> "kamon.lib.@0").inAll + ), + assemblyExcludedJars in assembly := { + (fullClasspath in assembly).value.filter(f => { + val fileName = f.data.getName() + fileName.contains("kamon-core") || fileName.contains("oshi-core") + }) + }, + assemblyOption in assembly := (assemblyOption in assembly).value.copy( + includeBin = true, + includeScala = false, + includeDependency = false, + cacheOutput = false + ), + assemblyMergeStrategy in assembly := { + case "reference.conf" => MergeStrategy.concat + case anyOther => (assemblyMergeStrategy in assembly).value(anyOther) + } + ).dependsOn( + `kamon-core`, + `kamon-status-page` % "shaded", + `kamon-instrumentation-common` % "shaded", + `kamon-executors` % "shaded", + `kamon-scala-future` % "shaded", + `kamon-twitter-future` % "shaded", + `kamon-scalaz-future` % "shaded", + `kamon-cats-io` % "shaded", + `kamon-logback` % "shaded", + `kamon-jdbc` % "shaded", + `kamon-mongo` % "shaded", + `kamon-annotation` % "shaded", + `kamon-annotation-api` % "shaded", + `kamon-system-metrics` % "shaded", + `kamon-akka` % "shaded", + `kamon-akka-http` % "shaded", + `kamon-play` % "shaded" + ) \ No newline at end of file diff --git a/bundle/kamon-bundle/src/main/scala/kamon/bundle/Bundle.scala b/bundle/kamon-bundle/src/main/scala/kamon/bundle/Bundle.scala new file mode 100644 index 000000000..13fa33f01 --- /dev/null +++ b/bundle/kamon-bundle/src/main/scala/kamon/bundle/Bundle.scala @@ -0,0 +1,93 @@ +package kamon.bundle + +import java.lang.management.ManagementFactory +import java.nio.file.{Files, StandardCopyOption} + +import net.bytebuddy.agent.ByteBuddyAgent + +object Bundle { + + private val _instrumentationClassLoaderProp = "kanela.instrumentation.classLoader" + + /** + * Attaches the Kanela agent to the current JVM. This method will ignore any attempts to attach the agent if it has + * been attached already. + */ + def attach(): Unit = { + val springBootClassLoader = findSpringBootJarLauncherClassLoader() + + if(isKanelaLoaded) { + + // If Kanela has already been loaded and we are running on a Spring Boot application, we might need to reload + // Kanela to ensure it will use the proper ClassLoader for loading the instrumentations. + springBootClassLoader.foreach(sbClassLoader => { + withInstrumentationClassLoader(sbClassLoader)(reloadKanela()) + }) + + } else { + + val embeddedAgentFile = Bundle.getClass.getClassLoader.getResourceAsStream(BuildInfo.kanelaAgentJarName) + val temporaryAgentFile = Files.createTempFile(BuildInfo.kanelaAgentJarName, ".jar") + Files.copy(embeddedAgentFile, temporaryAgentFile, StandardCopyOption.REPLACE_EXISTING) + + withInstrumentationClassLoader(springBootClassLoader.orNull) { + ByteBuddyAgent.attach(temporaryAgentFile.toFile, pid()) + } + } + } + + /** + * Tries to determine whether the Kanela agent has been loaded already. Since there are no APIs to determine what + * agents have been loaded on the current JVM, we rely on two cues that indicate that Kanela is present: first, the + * "kanela.loaded" System property which is set to "true" when the Kanela agent is started and second, the presence + * of the Kanela class in the System ClassLoader. None of these two cues are definite proof, but having both of them + * gives a level of certainty of the Kanela agent being loaded already. + */ + private def isKanelaLoaded(): Boolean = { + val isLoadedProperty = java.lang.Boolean.parseBoolean(System.getProperty("kanela.loaded")) + val hasKanelaClasses = try { + Class.forName("kanela.agent.Kanela", false, ClassLoader.getSystemClassLoader) != null + } catch { case _: Throwable => false } + + hasKanelaClasses && isLoadedProperty + } + + /** + * Tries to find Spring Boot's classloader, if any. When running a Spring Boot application packaged with the + * "spring-boot-maven-plugin", a fat jar will be created with all the dependencies in it and a special ClassLoader is + * used to unpack them when the jar launches. This function will try to find that ClassLoader which should be used to + * load all Kanela modules. + */ + private def findSpringBootJarLauncherClassLoader(): Option[ClassLoader] = { + Option(Thread.currentThread().getContextClassLoader()) + .filter(cl => cl.getClass.getName == "org.springframework.boot.loader.LaunchedURLClassLoader") + } + + + /** + * Reloads the Kanela agent. This will cause all instrumentation definitions to be dropped and re-initialized. + */ + private def reloadKanela(): Unit = { + + // We know that if the agent has been attached, its classes are in the System ClassLoader so we try to find + // the Kanela class from there and call reload on it. + Class.forName("kanela.agent.Kanela", true, ClassLoader.getSystemClassLoader) + .getDeclaredMethod("reload") + .invoke(null) + } + + private def pid(): String = { + val jvm = ManagementFactory.getRuntimeMXBean.getName + jvm.substring(0, jvm.indexOf('@')) + } + + def withInstrumentationClassLoader[T](classLoader: ClassLoader)(thunk: => T): T = { + try { + if(classLoader != null) + System.getProperties.put(_instrumentationClassLoaderProp, classLoader) + thunk + } finally { + System.getProperties.remove(_instrumentationClassLoaderProp) + } + } +} diff --git a/core/kamon-core-tests/src/test/resources/logback.xml b/core/kamon-core-tests/src/test/resources/logback.xml new file mode 100644 index 000000000..e966d7be8 --- /dev/null +++ b/core/kamon-core-tests/src/test/resources/logback.xml @@ -0,0 +1,14 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + \ No newline at end of file diff --git a/core/kamon-core/src/main/scala/kamon/metric/Distribution.scala b/core/kamon-core/src/main/scala/kamon/metric/Distribution.scala index 5ef72fb23..2ad2d0a54 100644 --- a/core/kamon-core/src/main/scala/kamon/metric/Distribution.scala +++ b/core/kamon-core/src/main/scala/kamon/metric/Distribution.scala @@ -148,7 +148,7 @@ object Distribution { * to the provided dynamic range if necessary. */ def merge(left: Distribution, right: Distribution, dynamicRange: DynamicRange): Distribution = { - val h = LocalHistogram.get(dynamicRange) + val h = Histogram.Local.get(dynamicRange) left.bucketsIterator.foreach(b => h.recordValueWithCount(b.value, b.frequency)) right.bucketsIterator.foreach(b => h.recordValueWithCount(b.value, b.frequency)) h.snapshot(true) @@ -199,7 +199,7 @@ object Distribution { if(unit == actualToUnit && distribution.dynamicRange == toDynamicRange) distribution else { - val scaledHistogram = LocalHistogram.get(toDynamicRange) + val scaledHistogram = Histogram.Local.get(toDynamicRange) distribution.bucketsIterator.foreach(bucket => { val roundValue = Math.round(MeasurementUnit.convert(bucket.value, unit, toUnit)) val convertedValue = if(roundValue == 0L) 1L else roundValue @@ -333,34 +333,4 @@ object Distribution { case class Bucket(value: Long, frequency: Long) extends Distribution.Bucket case class Percentile(rank: Double, value: Long, countAtRank: Long) extends Distribution.Percentile } - - /** - * Histogram implementation that can only be used local to a thread or with external synchronization. This is only - * used to power aggregation of distributions given that it is a lot simpler to create histograms and dump all the - * values on them rather than trying to manually aggregate the buckets and take into account adjustments on dynamic - * range. - */ - private[kamon] class LocalHistogram(val dynamicRange: DynamicRange) extends BaseLocalHdrHistogram(dynamicRange) - with Instrument.Snapshotting[Distribution] with DistributionSnapshotBuilder - - private[kamon] object LocalHistogram { - - /** Keeps a thread-local cache of local histograms that can be reused when aggregating distributions. */ - private val _localHistograms = new ThreadLocal[collection.mutable.Map[DynamicRange, LocalHistogram]] { - override def initialValue(): collection.mutable.Map[DynamicRange, LocalHistogram] = - collection.mutable.Map.empty - } - - /** - * Creates or retrieves a local histogram for the provided dynamic range. In theory, it is safe to do this from the - * memory usage perspective since distribution merging or converting (the use cases for a Local Histogram) are only - * expected to happen on reporter threads and all reporters have their own dedicated thread so we wont have many - * instances around. - */ - def get(dynamicRange: DynamicRange): LocalHistogram = { - val histogram = _localHistograms.get().getOrElseUpdate(dynamicRange, new LocalHistogram(dynamicRange)) - histogram.reset() - histogram - } - } } diff --git a/core/kamon-core/src/main/scala/kamon/metric/Histogram.scala b/core/kamon-core/src/main/scala/kamon/metric/Histogram.scala index 3ee117c8b..57944f44d 100644 --- a/core/kamon-core/src/main/scala/kamon/metric/Histogram.scala +++ b/core/kamon-core/src/main/scala/kamon/metric/Histogram.scala @@ -20,7 +20,7 @@ import java.nio.ByteBuffer import kamon.metric.Metric.{BaseMetric, BaseMetricAutoUpdate} import kamon.tag.TagSet -import org.HdrHistogram.{BaseAtomicHdrHistogram, HdrHistogramInternalState, ZigZag} +import org.HdrHistogram.{BaseAtomicHdrHistogram, BaseLocalHdrHistogram, HdrHistogramInternalState, ZigZag} import org.slf4j.LoggerFactory @@ -162,4 +162,34 @@ object Histogram { override def initialValue(): ByteBuffer = ByteBuffer.allocate(33792) } } + + /** + * Histogram implementation that can only be used local to a thread or with external synchronization. This is only + * used to power aggregation of distributions given that it is a lot simpler to create histograms and dump all the + * values on them rather than trying to manually aggregate the buckets and take into account adjustments on dynamic + * range. + */ + private[kamon] class Local(val dynamicRange: DynamicRange) extends BaseLocalHdrHistogram(dynamicRange) + with Instrument.Snapshotting[Distribution] with DistributionSnapshotBuilder + + private[kamon] object Local { + + /** Keeps a thread-local cache of local histograms that can be reused when aggregating distributions. */ + private val _localHistograms = new ThreadLocal[collection.mutable.Map[DynamicRange, Histogram.Local]] { + override def initialValue(): collection.mutable.Map[DynamicRange, Histogram.Local] = + collection.mutable.Map.empty + } + + /** + * Creates or retrieves a local histogram for the provided dynamic range. In theory, it is safe to do this from the + * memory usage perspective since distribution merging or converting (the use cases for a Local Histogram) are only + * expected to happen on reporter threads and all reporters have their own dedicated thread so we wont have many + * instances around. + */ + def get(dynamicRange: DynamicRange): Histogram.Local = { + val histogram = _localHistograms.get().getOrElseUpdate(dynamicRange, new Histogram.Local(dynamicRange)) + histogram.reset() + histogram + } + } } diff --git a/core/kamon-testkit/src/main/scala/kamon/testkit/MetricSnapshotBuilder.scala b/core/kamon-testkit/src/main/scala/kamon/testkit/MetricSnapshotBuilder.scala index 7dc7673b5..f25643031 100644 --- a/core/kamon-testkit/src/main/scala/kamon/testkit/MetricSnapshotBuilder.scala +++ b/core/kamon-testkit/src/main/scala/kamon/testkit/MetricSnapshotBuilder.scala @@ -2,7 +2,7 @@ package kamon.testkit import java.time.Duration -import kamon.metric.Distribution.LocalHistogram +import kamon.metric.Histogram import kamon.metric.Metric.Settings import kamon.metric.{DynamicRange, Instrument, MeasurementUnit, MetricSnapshot} import kamon.tag.TagSet @@ -79,7 +79,7 @@ object MetricSnapshotBuilder { * attributes and values. */ def histogram(name: String, description: String, tags: TagSet, unit: MeasurementUnit)(values: Long*): MetricSnapshot.Distributions = { - val localHistogram = LocalHistogram.get(DynamicRange.Default) + val localHistogram = Histogram.Local.get(DynamicRange.Default) localHistogram.reset() values.foreach(v => localHistogram.recordValue(v)) diff --git a/instrumentation/kamon-akka/build.sbt b/instrumentation/kamon-akka/build.sbt index b0afb18db..1b461b13d 100644 --- a/instrumentation/kamon-akka/build.sbt +++ b/instrumentation/kamon-akka/build.sbt @@ -31,7 +31,7 @@ configs( // The Common configuration should always depend on the latest version of Akka. All code in the Common configuration // should be source compatible with all Akka versions. inConfig(Common)(Defaults.compileSettings ++ Seq( - crossScalaVersions := Seq("2.12.10", "2.13.1") + crossScalaVersions := Seq("2.12.11", "2.13.1") )) libraryDependencies ++= { if(scalaBinaryVersion.value == "2.11") Seq.empty else Seq( @@ -50,7 +50,7 @@ libraryDependencies ++= { if(scalaBinaryVersion.value == "2.11") Seq.empty else inConfig(`Compile-Akka-2.6`)(Defaults.compileSettings ++ Seq( - crossScalaVersions := Seq("2.12.10", "2.13.1"), + crossScalaVersions := Seq("2.12.11", "2.13.1"), sources := joinSources(Common, `Compile-Akka-2.6`).value )) @@ -130,7 +130,7 @@ lazy val baseTestSettings = Seq( ) inConfig(TestCommon)(Defaults.testSettings ++ instrumentationSettings ++ baseTestSettings ++ Seq( - crossScalaVersions := Seq("2.12.10", "2.13.1") + crossScalaVersions := Seq("2.12.11", "2.13.1") )) inConfig(`Test-Akka-2.5`)(Defaults.testSettings ++ instrumentationSettings ++ baseTestSettings ++ Seq( @@ -140,7 +140,7 @@ inConfig(`Test-Akka-2.5`)(Defaults.testSettings ++ instrumentationSettings ++ ba )) inConfig(`Test-Akka-2.6`)(Defaults.testSettings ++ instrumentationSettings ++ baseTestSettings ++ Seq( - crossScalaVersions := Seq("2.12.10", "2.13.1"), + crossScalaVersions := Seq("2.12.11", "2.13.1"), sources := joinSources(TestCommon, `Test-Akka-2.6`).value, unmanagedResourceDirectories ++= (unmanagedResourceDirectories in Common).value, unmanagedResourceDirectories ++= (unmanagedResourceDirectories in TestCommon).value diff --git a/instrumentation/kamon-executors/build.sbt b/instrumentation/kamon-executors/build.sbt new file mode 100644 index 000000000..602f2dd49 --- /dev/null +++ b/instrumentation/kamon-executors/build.sbt @@ -0,0 +1,23 @@ +import sbt.Tests.{Group, SubProcess} + +testGrouping in Test := groupByExperimentalExecutorTests((definedTests in Test).value, kanelaAgentJar.value) + +def groupByExperimentalExecutorTests(tests: Seq[TestDefinition], kanelaJar: File): Seq[Group] = { + val (stable, experimental) = tests.partition(t => t.name != "kamon.instrumentation.executor.CaptureContextOnSubmitInstrumentationSpec") + + val stableGroup = Group("stableTests", stable, SubProcess( + ForkOptions().withRunJVMOptions(Vector( + "-javaagent:" + kanelaJar.toString + )) + )) + + val experimentalGroup = Group("experimentalTests", experimental, SubProcess( + ForkOptions().withRunJVMOptions(Vector( + "-javaagent:" + kanelaJar.toString, + "-Dkanela.modules.executor-service.enabled=false", + "-Dkanela.modules.executor-service-capture-on-submit.enabled=true" + )) + )) + + Seq(stableGroup, experimentalGroup) +} \ No newline at end of file diff --git a/instrumentation/kamon-play/build.sbt b/instrumentation/kamon-play/build.sbt index 308a305ca..804a00446 100644 --- a/instrumentation/kamon-play/build.sbt +++ b/instrumentation/kamon-play/build.sbt @@ -51,12 +51,12 @@ lazy val baseTestSettings = Seq( ) inConfig(TestCommon)(Defaults.testSettings ++ instrumentationSettings ++ baseTestSettings ++ Seq( - crossScalaVersions := Seq("2.11.12", "2.12.10") + crossScalaVersions := Seq("2.11.12", "2.12.11") )) inConfig(`Test-Play-2.6`)(Defaults.testSettings ++ instrumentationSettings ++ baseTestSettings ++ Seq( sources := joinSources(TestCommon, `Test-Play-2.6`).value, - crossScalaVersions := Seq("2.11.12", "2.12.10"), + crossScalaVersions := Seq("2.11.12", "2.12.11"), testGrouping := singleTestPerJvm(definedTests.value, javaOptions.value), unmanagedResourceDirectories ++= (unmanagedResourceDirectories in Compile).value, unmanagedResourceDirectories ++= (unmanagedResourceDirectories in TestCommon).value, diff --git a/project/Build.scala b/project/Build.scala index 6817bf677..e9d9f70aa 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -3,7 +3,7 @@ import Keys._ import sbt.librarymanagement.{Configuration, Configurations} import Configurations.Compile import sbtassembly.AssemblyPlugin -import sbtassembly.AssemblyPlugin.autoImport.{MergeStrategy, assembleArtifact, assembly, assemblyExcludedJars, assemblyMergeStrategy, assemblyPackageScala} +import sbtassembly.AssemblyPlugin.autoImport.{MergeStrategy, assembleArtifact, assembly, assemblyExcludedJars, assemblyMergeStrategy, assemblyPackageScala, assemblyOption} import java.util.Calendar import Def.Initialize @@ -27,12 +27,14 @@ object BaseProject extends AutoPlugin { /** Marker configuration for dependencies that will be shaded into their module's jar. */ lazy val Shaded = config("shaded").hide - val kanelaAgent = "io.kamon" % "kanela-agent" % "1.0.4" - val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.25" - val slf4jnop = "org.slf4j" % "slf4j-nop" % "1.7.24" - val logbackClassic = "ch.qos.logback" % "logback-classic" % "1.2.3" - val scalatest = "org.scalatest" %% "scalatest" % "3.0.8" - val hdrHistogram = "org.hdrhistogram" % "HdrHistogram" % "2.1.10" + val kanelaAgent = "io.kamon" % "kanela-agent" % "1.0.4" + val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.25" + val slf4jnop = "org.slf4j" % "slf4j-nop" % "1.7.24" + val logbackClassic = "ch.qos.logback" % "logback-classic" % "1.2.3" + val scalatest = "org.scalatest" %% "scalatest" % "3.0.8" + val hdrHistogram = "org.hdrhistogram" % "HdrHistogram" % "2.1.10" + val okHttp = "com.squareup.okhttp3" % "okhttp" % "3.14.7" + val okHttpMockServer = "com.squareup.okhttp3" % "mockwebserver" % "3.10.0" val kanelaAgentVersion = settingKey[String]("Kanela Agent version") val kanelaAgentJar = taskKey[File]("Kanela Agent jar") @@ -87,6 +89,7 @@ object BaseProject extends AutoPlugin { commonSettings ++ compilationSettings ++ releaseSettings ++ publishingSettings private lazy val commonSettings = Seq( + exportJars := true, fork in Test := true, startYear := Some(2013), organization := "io.kamon", @@ -104,8 +107,8 @@ object BaseProject extends AutoPlugin { private lazy val compilationSettings = Seq( crossPaths := true, - scalaVersion := "2.12.10", - crossScalaVersions := Seq("2.11.12", "2.12.10", "2.13.1"), + scalaVersion := "2.12.11", + crossScalaVersions := Seq("2.11.12", "2.12.11", "2.13.1"), javacOptions := Seq( "-source", "1.8", "-target", "1.8", @@ -128,7 +131,7 @@ object BaseProject extends AutoPlugin { "-language:implicitConversions" ) ++ (CrossVersion.partialVersion(scalaVersion.value) match { case Some((2,11)) => Seq("-Xfuture", "-Ybackend:GenASM") - case Some((2,12)) => Seq("-Xfuture", "-opt:l:method") + case Some((2,12)) => Seq("-Xfuture", "-opt:l:method,-closure-invocations") case Some((2,13)) => Seq.empty case _ => Seq.empty }) @@ -174,14 +177,6 @@ object BaseProject extends AutoPlugin { )) } - private def scalaVersionSetting = Def.setting { - if (sbtPlugin.value) scalaVersion.value else "2.13.1" - } - - private def crossScalaVersionsSetting = Def.setting { - if (sbtPlugin.value) Seq(scalaVersion.value) else Seq("2.11.12", "2.12.10", "2.13.1") - } - def findKanelaAgentJar = Def.task { update.value.matching { moduleFilter(organization = "io.kamon", name = "kanela-agent") && @@ -267,19 +262,20 @@ object AssemblyTweaks extends AutoPlugin { override def trigger = allRequirements override def projectConfigurations: Seq[Configuration] = Seq(Shaded) override def projectSettings: Seq[Def.Setting[_]] = Seq( + exportJars := true, + test in assembly := {}, packageBin in Compile := assembly.value, - assembleArtifact in assemblyPackageScala := false, - exportedProducts in Compile ++= (unmanagedClasspath in Compile).value, - unmanagedClasspath in Compile ++= update.value.select(configurationFilter(Shaded.name)), - assemblyExcludedJars in assembly := { - val classpath = (fullClasspath in assembly).value - val shadedDependencies = update.value.select(configurationFilter(Shaded.name)).map(_.getPath) - classpath filterNot { file => shadedDependencies.exists(file.data.getPath.contains(_))} - }, + fullClasspath in assembly := (externalDependencyClasspath in Shaded).value ++ (products in Compile).value.classpath, + assemblyOption in assembly := (assemblyOption in assembly).value.copy( + includeBin = true, + includeScala = false, + includeDependency = true, + cacheOutput = false + ), assemblyMergeStrategy in assembly := { case s if s.startsWith("LICENSE") => MergeStrategy.discard case s if s.startsWith("about") => MergeStrategy.discard case x => (assemblyMergeStrategy in assembly).value(x) } - ) + ) ++ inConfig(Shaded)(Defaults.configSettings) } diff --git a/project/BundleKeys.scala b/project/BundleKeys.scala new file mode 100644 index 000000000..5674778a9 --- /dev/null +++ b/project/BundleKeys.scala @@ -0,0 +1,10 @@ +import sbt.librarymanagement.syntax.ExclusionRule +import sbt.{ ModuleID, settingKey, taskKey} + +object BundleKeys { + val kanelaAgentModule = settingKey[ModuleID]("Dependency on the Kanela agent") + val kanelaAgentJarName = taskKey[String]("Name of the embedded kanela jar") + val bundleDependencies = settingKey[Seq[ModuleID]]("Dependencies") + val kamonCoreExclusion = settingKey[ExclusionRule]("excludes core") + +} diff --git a/project/build.properties b/project/build.properties index a919a9b5f..06703e34d 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.8 +sbt.version=1.3.9 diff --git a/reporters/kamon-apm-reporter/src/main/scala/kamon/apm/KamonApm.scala b/reporters/kamon-apm-reporter/src/main/scala/kamon/apm/KamonApm.scala index 6cdf69142..434ce1250 100644 --- a/reporters/kamon-apm-reporter/src/main/scala/kamon/apm/KamonApm.scala +++ b/reporters/kamon-apm-reporter/src/main/scala/kamon/apm/KamonApm.scala @@ -10,7 +10,7 @@ import kamino.IngestionV1 import kamino.IngestionV1.InstrumentType.{COUNTER, GAUGE, HISTOGRAM, MIN_MAX_COUNTER} import kamino.IngestionV1._ import org.HdrHistogram.ZigZag -import kamon.metric.Distribution.{LocalHistogram, ZigZagCounts} +import kamon.metric.Distribution.ZigZagCounts import kamon.metric.{DynamicRange, Instrument, MetricSnapshot, PeriodSnapshot} import kamon.metric.MeasurementUnit.{information, time} import kamon.module.{CombinedReporter, Module, ModuleFactory} diff --git a/version.sbt b/version.sbt deleted file mode 100644 index c6704698d..000000000 --- a/version.sbt +++ /dev/null @@ -1 +0,0 @@ -version in ThisBuild := "2.0.1-SNAPSHOT"