Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump packaged libs #1329

Merged
merged 5 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ jobs:
- uses: actions/checkout@v1
- uses: coursier/cache-action@v6
- name: Test
run: sbt -v "scalafmtCheckAll"
run: sbt -v "+scalafmtCheckAll"

17 changes: 8 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ lazy val `kamon-core` = (project in file("core/kamon-core"))
).inAll
),
libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.4.1",
"com.typesafe" % "config" % "1.4.3",
"org.slf4j" % "slf4j-api" % "1.7.36",
"org.hdrhistogram" % "HdrHistogram" % "2.1.9" % "provided,shaded",
"org.jctools" % "jctools-core" % "3.3.0" % "provided,shaded",
Expand Down Expand Up @@ -188,7 +188,7 @@ lazy val `kamon-executors-bench` = (project in file("instrumentation/kamon-execu
.settings(noPublishing: _*)
.settings(
libraryDependencies ++= Seq(
"com.google.guava" % "guava" % "24.1-jre",
"com.google.guava" % "guava" % "33.0.0-jre",
kanelaAgent % "provided",
)
).dependsOn(`kamon-core`, `kamon-instrumentation-common`)
Expand Down Expand Up @@ -856,7 +856,7 @@ lazy val `kamon-datadog` = (project in file("reporters/kamon-datadog"))
),
libraryDependencies ++= Seq(
okHttp % "shaded,provided",
"com.grack" % "nanojson" % "1.6",
"com.grack" % "nanojson" % "1.8",

("com.typesafe.play" %% "play-json" % "2.7.4" % "test").cross(CrossVersion.for3Use2_13),
scalatest % "test",
Expand Down Expand Up @@ -910,8 +910,8 @@ lazy val `kamon-zipkin` = (project in file("reporters/kamon-zipkin"))
.disablePlugins(AssemblyPlugin)
.settings(
libraryDependencies ++= Seq(
"io.zipkin.reporter2" % "zipkin-reporter" % "2.7.15",
"io.zipkin.reporter2" % "zipkin-sender-okhttp3" % "2.7.15",
"io.zipkin.reporter2" % "zipkin-reporter" % "3.3.0",
"io.zipkin.reporter2" % "zipkin-sender-okhttp3" % "3.3.0",
scalatest % "test"
)
).dependsOn(`kamon-core`)
Expand Down Expand Up @@ -952,8 +952,8 @@ lazy val `kamon-newrelic` = (project in file("reporters/kamon-newrelic"))
.disablePlugins(AssemblyPlugin)
.settings(
libraryDependencies ++= Seq(
"com.newrelic.telemetry" % "telemetry-core" % "0.15.0",
"com.newrelic.telemetry" % "telemetry-http-okhttp" % "0.15.0",
"com.newrelic.telemetry" % "telemetry-core" % "0.16.0",
"com.newrelic.telemetry" % "telemetry-http-okhttp" % "0.16.0",
scalatest % "test",
"org.mockito" % "mockito-core" % "3.12.4" % "test"
)
Expand All @@ -963,8 +963,7 @@ lazy val `kamon-opentelemetry` = (project in file("reporters/kamon-opentelemetry
.disablePlugins(AssemblyPlugin)
.settings(
libraryDependencies ++= Seq(
"io.opentelemetry" % "opentelemetry-exporter-otlp-http-trace" % "1.13.0",
"io.opentelemetry" % "opentelemetry-exporter-otlp-trace" % "1.13.0",
"io.opentelemetry" % "opentelemetry-exporter-otlp" % "1.35.0",
// Compile-time dependency required in scala 3
"com.google.auto.value" % "auto-value-annotations" % "1.9" % "compile",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import kanela.agent.libs.net.bytebuddy.matcher.ElementMatchers.isPublic

import scala.collection.immutable


class AkkaHttpServerInstrumentation extends InstrumentationBuilder {

/**
Expand Down Expand Up @@ -69,7 +68,10 @@ class AkkaHttpServerInstrumentation extends InstrumentationBuilder {
onType("akka.http.scaladsl.server.directives.FutureDirectives$class")
.intercept(method("onComplete"), classOf[ResolveOperationNameOnRouteInterceptor])

onTypes("akka.http.scaladsl.server.directives.OnSuccessMagnet$", "akka.http.scaladsl.server.directives.CompleteOrRecoverWithMagnet$")
onTypes(
"akka.http.scaladsl.server.directives.OnSuccessMagnet$",
"akka.http.scaladsl.server.directives.CompleteOrRecoverWithMagnet$"
)
.intercept(method("apply"), classOf[ResolveOperationNameOnRouteInterceptor])

onType("akka.http.scaladsl.server.directives.RouteDirectives$class")
Expand Down Expand Up @@ -97,12 +99,13 @@ trait HasMatchingContext {

object HasMatchingContext {

case class PathMatchingContext (
case class PathMatchingContext(
fullPath: String,
matched: Matched[_]
)

class Mixin(var matchingContext: Seq[PathMatchingContext], var defaultOperationName: String) extends HasMatchingContext {
class Mixin(var matchingContext: Seq[PathMatchingContext], var defaultOperationName: String)
extends HasMatchingContext {

override def setMatchingContext(matchingContext: Seq[PathMatchingContext]): Unit =
this.matchingContext = matchingContext
Expand Down Expand Up @@ -136,7 +139,9 @@ object ResolveOperationNameOnRouteInterceptor {
def complete[T](status: StatusCode, v: => T)(implicit m: ToEntityMarshaller[T]): StandardRoute =
StandardRoute(resolveOperationName(_).complete((status, v)))

def complete[T](status: StatusCode, headers: immutable.Seq[HttpHeader], v: => T)(implicit m: ToEntityMarshaller[T]): StandardRoute =
def complete[T](status: StatusCode, headers: immutable.Seq[HttpHeader], v: => T)(implicit
m: ToEntityMarshaller[T]
): StandardRoute =
complete((status, headers, v))

def redirect(@Argument(1) uri: Uri, @Argument(2) redirectionType: Redirection): StandardRoute =
Expand Down Expand Up @@ -185,18 +190,18 @@ object ResolveOperationNameOnRouteInterceptor {
Kamon.currentContext().get(LastAutomaticOperationNameEdit.Key).foreach(lastEdit => {
val currentSpan = Kamon.currentSpan()

if(lastEdit.allowAutomaticChanges) {
if(currentSpan.operationName() == lastEdit.operationName) {
val allMatches = requestContext.asInstanceOf[HasMatchingContext].matchingContext.reverse.map(singleMatch)
val operationName = allMatches.mkString("")
if (lastEdit.allowAutomaticChanges) {
if (currentSpan.operationName() == lastEdit.operationName) {
val allMatches = requestContext.asInstanceOf[HasMatchingContext].matchingContext.reverse.map(singleMatch)
val operationName = allMatches.mkString("")

if(operationName.nonEmpty) {
if (operationName.nonEmpty) {
currentSpan
.name(operationName)
.takeSamplingDecision()
.name(operationName)
.takeSamplingDecision()

lastEdit.operationName = operationName
}
lastEdit.operationName = operationName
}
} else {
lastEdit.allowAutomaticChanges = false
}
Expand All @@ -214,7 +219,7 @@ object ResolveOperationNameOnRouteInterceptor {
val consumedSegment = matching.fullPath.substring(0, consumedCount)

matching.matched.extractions match {
case () => //string segment matched
case () => // string segment matched
consumedSegment
case tuple: Product =>
val values = tuple.productIterator.toList map {
Expand Down Expand Up @@ -260,7 +265,9 @@ object RequestContextCopyInterceptor {
@RuntimeType
def copy(@This context: RequestContext, @SuperCall copyCall: Callable[RequestContext]): RequestContext = {
val copiedRequestContext = copyCall.call()
copiedRequestContext.asInstanceOf[HasMatchingContext].setMatchingContext(context.asInstanceOf[HasMatchingContext].matchingContext)
copiedRequestContext.asInstanceOf[HasMatchingContext].setMatchingContext(
context.asInstanceOf[HasMatchingContext].matchingContext
)
copiedRequestContext
}
}
Expand Down Expand Up @@ -288,8 +295,7 @@ object PathDirectivesRawPathPrefixInterceptor {
} flatMap {
case (ctx, Matched(rest, values)) =>
tprovide(values) & mapRequestContext(_ withUnmatchedPath rest) & mapRouteResult { routeResult =>

if(routeResult.isInstanceOf[Rejected])
if (routeResult.isInstanceOf[Rejected])
ctx.asInstanceOf[HasMatchingContext].popOneMatchingContext()

routeResult
Expand All @@ -300,7 +306,6 @@ object PathDirectivesRawPathPrefixInterceptor {
}
}


object Http2BlueprintInterceptor {

case class HandlerWithEndpoint(interface: String, port: Int, handler: HttpRequest => Future[HttpResponse])
Expand All @@ -310,8 +315,10 @@ object Http2BlueprintInterceptor {
}

@RuntimeType
def handleWithStreamIdHeader(@Argument(1) handler: HttpRequest => Future[HttpResponse],
@SuperCall zuper: Callable[Flow[HttpRequest, HttpResponse, NotUsed]]): Flow[HttpRequest, HttpResponse, NotUsed] = {
def handleWithStreamIdHeader(
@Argument(1) handler: HttpRequest => Future[HttpResponse],
@SuperCall zuper: Callable[Flow[HttpRequest, HttpResponse, NotUsed]]
): Flow[HttpRequest, HttpResponse, NotUsed] = {

handler match {
case HandlerWithEndpoint(interface, port, _) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import kanela.agent.libs.net.bytebuddy.matcher.ElementMatchers.isPublic
import scala.annotation.static
import scala.collection.immutable


class AkkaHttpServerInstrumentation extends InstrumentationBuilder {

/**
* When instrumenting bindAndHandle what we do is wrap the Flow[HttpRequest, HttpResponse, NotUsed] provided by
* the user and add all the processing there. This is the part of the instrumentation that performs Context
Expand Down Expand Up @@ -70,15 +70,17 @@ class AkkaHttpServerInstrumentation extends InstrumentationBuilder {
onType("akka.http.scaladsl.server.directives.FutureDirectives")
.intercept(method("onComplete"), classOf[ResolveOperationNameOnRouteInterceptor])

onTypes("akka.http.scaladsl.server.directives.OnSuccessMagnet$", "akka.http.scaladsl.server.directives.CompleteOrRecoverWithMagnet$")
onTypes(
"akka.http.scaladsl.server.directives.OnSuccessMagnet$",
"akka.http.scaladsl.server.directives.CompleteOrRecoverWithMagnet$"
)
.intercept(method("apply"), classOf[ResolveOperationNameOnRouteInterceptor])

onType("akka.http.scaladsl.server.directives.RouteDirectives")
.intercept(method("complete"), classOf[ResolveOperationNameOnRouteInterceptor])
.intercept(method("redirect"), classOf[ResolveOperationNameOnRouteInterceptor])
.intercept(method("failWith"), classOf[ResolveOperationNameOnRouteInterceptor])


/**
* Akka-http 10.1.x compatibility.
*/
Expand Down Expand Up @@ -106,12 +108,13 @@ trait HasMatchingContext {

object HasMatchingContext {

case class PathMatchingContext (
case class PathMatchingContext(
fullPath: String,
matched: Matched[_]
)

class Mixin(var matchingContext: Seq[PathMatchingContext], var defaultOperationName: String) extends HasMatchingContext {
class Mixin(var matchingContext: Seq[PathMatchingContext], var defaultOperationName: String)
extends HasMatchingContext {

override def setMatchingContext(matchingContext: Seq[PathMatchingContext]): Unit =
this.matchingContext = matchingContext
Expand Down Expand Up @@ -145,7 +148,9 @@ object ResolveOperationNameOnRouteInterceptor {
def complete[T](status: StatusCode, v: => T)(implicit m: ToEntityMarshaller[T]): StandardRoute =
StandardRoute(resolveOperationName(_).complete((status, v)))

def complete[T](status: StatusCode, headers: immutable.Seq[HttpHeader], v: => T)(implicit m: ToEntityMarshaller[T]): StandardRoute =
def complete[T](status: StatusCode, headers: immutable.Seq[HttpHeader], v: => T)(implicit
m: ToEntityMarshaller[T]
): StandardRoute =
complete((status, headers, v))

def redirect(uri: Uri, redirectionType: Redirection): StandardRoute =
Expand Down Expand Up @@ -194,8 +199,8 @@ object ResolveOperationNameOnRouteInterceptor {
Kamon.currentContext().get(LastAutomaticOperationNameEdit.Key).foreach(lastEdit => {
val currentSpan = Kamon.currentSpan()

if(lastEdit.allowAutomaticChanges) {
if(currentSpan.operationName() == lastEdit.operationName) {
if (lastEdit.allowAutomaticChanges) {
if (currentSpan.operationName() == lastEdit.operationName) {
val allMatches = requestContext.asInstanceOf[HasMatchingContext].matchingContext.reverse.map(singleMatch)
val operationName = allMatches.mkString("")

Expand Down Expand Up @@ -223,7 +228,7 @@ object ResolveOperationNameOnRouteInterceptor {
val consumedSegment = matching.fullPath.substring(0, consumedCount)

matching.matched.extractions match {
case () => //string segment matched
case () => // string segment matched
consumedSegment
case tuple: Product =>
val values = tuple.productIterator.toList map {
Expand Down Expand Up @@ -270,7 +275,9 @@ object RequestContextCopyInterceptor {
@RuntimeType
@static def copy(@This context: RequestContext, @SuperCall copyCall: Callable[RequestContext]): RequestContext = {
val copiedRequestContext = copyCall.call()
copiedRequestContext.asInstanceOf[HasMatchingContext].setMatchingContext(context.asInstanceOf[HasMatchingContext].matchingContext)
copiedRequestContext.asInstanceOf[HasMatchingContext].setMatchingContext(
context.asInstanceOf[HasMatchingContext].matchingContext
)
copiedRequestContext
}
}
Expand All @@ -297,8 +304,7 @@ object PathDirectivesRawPathPrefixInterceptor {
} flatMap {
case (ctx, Matched(rest, values)) =>
tprovide[T](values) & mapRequestContext(_ withUnmatchedPath rest) & mapRouteResult { routeResult =>

if(routeResult.isInstanceOf[Rejected])
if (routeResult.isInstanceOf[Rejected])
ctx.asInstanceOf[HasMatchingContext].popOneMatchingContext()

routeResult
Expand All @@ -319,8 +325,10 @@ object Http2BlueprintInterceptor {
}

@RuntimeType
@static def handleWithStreamIdHeader(@Argument(1) handler: HttpRequest => Future[HttpResponse],
@SuperCall zuper: Callable[Flow[HttpRequest, HttpResponse, NotUsed]]): Flow[HttpRequest, HttpResponse, NotUsed] = {
@static def handleWithStreamIdHeader(
@Argument(1) handler: HttpRequest => Future[HttpResponse],
@SuperCall zuper: Callable[Flow[HttpRequest, HttpResponse, NotUsed]]
): Flow[HttpRequest, HttpResponse, NotUsed] = {

handler match {
case HandlerWithEndpoint(interface, port, _) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kamon.instrumentation
package object executor {
type ScalaForkJoinPool = scala.concurrent.forkjoin.ForkJoinPool
type ScalaForkJoinPool = scala.concurrent.forkjoin.ForkJoinPool
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kamon.instrumentation
package object executor {
type ScalaForkJoinPool = java.util.concurrent.ForkJoinPool
type ScalaForkJoinPool = java.util.concurrent.ForkJoinPool
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kamon.instrumentation
package object executor {
type ScalaForkJoinPool = java.util.concurrent.ForkJoinPool
type ScalaForkJoinPool = java.util.concurrent.ForkJoinPool
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package scala.annotation

import scala.annotation.meta._
final class static extends StaticAnnotation
final class static extends StaticAnnotation
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package scala.annotation

import scala.annotation.meta._
final class static extends StaticAnnotation
final class static extends StaticAnnotation
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ object CallbackRunnableRunInstrumentation {
def enter(@Advice.This runnable: HasContext with HasTimestamp with InternalState): Scope = {
val timestamp = runnable.timestamp
val valueContext = runnable.valueBridge().asInstanceOf[HasContext].context
val context = if(valueContext.nonEmpty()) valueContext else runnable.context
val context = if (valueContext.nonEmpty()) valueContext else runnable.context

storeCurrentRunnableTimestamp(timestamp)
Kamon.storeContext(context)
Expand Down Expand Up @@ -127,4 +127,4 @@ object CopyCurrentContextToArgument {
@Advice.OnMethodEnter(suppress = classOf[Throwable])
def enter(@Advice.Argument(0) arg: Any): Unit =
arg.asInstanceOf[HasContext].setContext(Kamon.currentContext())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ object CallbackRunnableRunInstrumentation {
def enter(@Advice.This runnable: HasContext with HasTimestamp with InternalState): Scope = {
val timestamp = runnable.timestamp
val valueContext = runnable.valueBridge().asInstanceOf[HasContext].context
val context = if(valueContext.nonEmpty()) valueContext else runnable.context
val context = if (valueContext.nonEmpty()) valueContext else runnable.context

storeCurrentRunnableTimestamp(timestamp)
Kamon.storeContext(context)
Expand Down Expand Up @@ -138,4 +138,4 @@ object CleanContextFromSeedFuture {
}

}
}
}
8 changes: 4 additions & 4 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ object BaseProject extends AutoPlugin {
val okHttp = "com.squareup.okhttp3" % "okhttp" % "4.12.0"
val okHttpMockServer = "com.squareup.okhttp3" % "mockwebserver" % "4.10.0"
val jsqlparser = "com.github.jsqlparser" % "jsqlparser" % "4.1"
val oshiCore = "com.github.oshi" % "oshi-core" % "5.7.5"
val oshiCore = "com.github.oshi" % "oshi-core" % "6.4.13"


val kanelaAgentVersion = settingKey[String]("Kanela Agent version")
Expand All @@ -57,8 +57,8 @@ object BaseProject extends AutoPlugin {
)

val `scala_2.11_version` = "2.11.12"
val `scala_2.12_version` = "2.12.15"
val `scala_2.13_version` = "2.13.8"
val `scala_2.12_version` = "2.12.19"
val `scala_2.13_version` = "2.13.13"
val scala_3_version = "3.3.1"

// This installs the GPG signing key from the
Expand Down Expand Up @@ -134,7 +134,7 @@ object BaseProject extends AutoPlugin {

private lazy val compilationSettings = Seq(
crossPaths := true,
scalaVersion := autoImport.`scala_2.12_version`,
scalaVersion := autoImport.`scala_2.13_version`,
crossScalaVersions := Seq(
autoImport.`scala_2.11_version`,
autoImport.`scala_2.12_version`,
Expand Down