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

Release scala-3 versions of kamon-akka, kamon-pekko and kamon-pekko-http #1295

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
test failures
hughsimpson authored and TjarkoG committed Nov 8, 2023
commit 75cd212843fe1e3c9f0f001ff91276fbbe6b2bc1
6 changes: 4 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -498,6 +498,9 @@ lazy val `kamon-pekko` = (project in file("instrumentation/kamon-pekko"))
.settings(instrumentationSettings: _*)
.settings(Seq(
crossScalaVersions := Seq(`scala_2.12_version`, `scala_2.13_version`),
libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-actor" % pekkoHttpVersion % "provided"
)
))
.dependsOn(
`kamon-scala-future` % "compile",
@@ -509,9 +512,8 @@ lazy val pekkoHttpVersion = "1.0.0"
lazy val `kamon-pekko-http` = (project in file("instrumentation/kamon-pekko-http"))
.enablePlugins(JavaAgent)
.disablePlugins(AssemblyPlugin)
.settings(instrumentationSettings :+ (crossScalaVersions += `scala_3_version`))
.settings(instrumentationSettings)
.settings(Seq(
javaAgents += "org.mortbay.jetty.alpn" % "jetty-alpn-agent" % "2.0.10" % "test",
crossScalaVersions := Seq(`scala_2.12_version`, `scala_2.13_version`),
libraryDependencies ++= Seq(
kanelaAgent % "provided",
Original file line number Diff line number Diff line change
@@ -19,8 +19,11 @@ package kamon.instrumentation.akka.instrumentations
import akka.actor.{ActorSystem, DeadLetter, UnhandledMessage}
import kamon.instrumentation.akka.AkkaMetrics
import kanela.agent.api.instrumentation.InstrumentationBuilder
import kanela.agent.libs.net.bytebuddy.asm.Advice
import kanela.agent.libs.net.bytebuddy.asm.Advice.{Argument, OnMethodExit, This}

import scala.annotation.static

class EventStreamInstrumentation extends InstrumentationBuilder {

/**
@@ -32,19 +35,20 @@ class EventStreamInstrumentation extends InstrumentationBuilder {
.advise(method("publish").and(takesArguments(1)), PublishMethodAdvice)
}


class ConstructorAdvice
object ConstructorAdvice {

@OnMethodExit(suppress = classOf[Throwable])
def exit(@This eventStream: HasSystem, @Argument(0) system:ActorSystem): Unit = {
@static def exit(@Advice.This eventStream: HasSystem, @Argument(0) system:ActorSystem): Unit = {
eventStream.setSystem(system)
}
}

class PublishMethodAdvice
object PublishMethodAdvice {

@OnMethodExit(suppress = classOf[Throwable])
def exit(@This stream:HasSystem, @Argument(0) event: AnyRef):Unit = event match {
@static def exit(@This stream:HasSystem, @Argument(0) event: AnyRef):Unit = event match {
case _: DeadLetter => AkkaMetrics.forSystem(stream.system.name).deadLetters.increment()
case _: UnhandledMessage => AkkaMetrics.forSystem(stream.system.name).unhandledMessages.increment()
case _ => ()
Original file line number Diff line number Diff line change
@@ -42,9 +42,9 @@ object ActorCellInfo {

val (actorOrRouterClass, routeeClass) =
if(isRouter)
(props.routerConfig.getClass, Some(ref.asInstanceOf[HasRouterProps].routeeProps.actorClass))
(props.routerConfig.getClass, Some(ref.asInstanceOf[HasRouterProps].routeeProps.actorClass()))
else if (isRoutee)
(parent.asInstanceOf[HasRouterProps].routerProps.routerConfig.getClass, Some(props.actorClass))
(parent.asInstanceOf[HasRouterProps].routerProps.routerConfig.getClass, Some(props.actorClass()))
else
(props.actorClass(), None)

Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ object AfterClusterInitializationAdvice {
def onClusterExtensionCreated(@Advice.Argument(0) system: ExtendedActorSystem, @Advice.Return clusterExtension: Cluster): Unit = {
val settings = PekkoInstrumentation.settings()
if(settings.exposeClusterMetrics) {
val stateExporter = system.systemActorOf(Props[ClusterInstrumentation.ClusterStateExporter], "kamon-cluster-state-exporter")
val stateExporter = system.systemActorOf(Props[ClusterInstrumentation.ClusterStateExporter](), "kamon-cluster-state-exporter")
clusterExtension.subscribe(stateExporter, classOf[ClusterEvent.ClusterDomainEvent])
}
}
Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@ import kamon.instrumentation.pekko.PekkoMetrics
import kanela.agent.api.instrumentation.InstrumentationBuilder
import kanela.agent.libs.net.bytebuddy.asm.Advice.{Argument, OnMethodExit, This}

import scala.annotation.static

class EventStreamInstrumentation extends InstrumentationBuilder {

/**
@@ -32,19 +34,20 @@ class EventStreamInstrumentation extends InstrumentationBuilder {
.advise(method("publish").and(takesArguments(1)), PublishMethodAdvice)
}


class ConstructorAdvice
object ConstructorAdvice {

@OnMethodExit(suppress = classOf[Throwable])
def exit(@This eventStream: HasSystem, @Argument(0) system:ActorSystem): Unit = {
@static def exit(@This eventStream: HasSystem, @Argument(0) system:ActorSystem): Unit = {
eventStream.setSystem(system)
}
}

class PublishMethodAdvice
object PublishMethodAdvice {

@OnMethodExit(suppress = classOf[Throwable])
def exit(@This stream:HasSystem, @Argument(0) event: AnyRef):Unit = event match {
@static def exit(@This stream:HasSystem, @Argument(0) event: AnyRef):Unit = event match {
case _: DeadLetter => PekkoMetrics.forSystem(stream.system.name).deadLetters.increment()
case _: UnhandledMessage => PekkoMetrics.forSystem(stream.system.name).unhandledMessages.increment()
case _ => ()
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ 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_3_version = "3.2.0"
val scala_3_version = "3.3.1"

// This installs the GPG signing key from the
setupGpg()