From 83ff19160f349fc3ae7a222d221bbefbe243dbfa Mon Sep 17 00:00:00 2001 From: Hugh Simpson Date: Thu, 9 Nov 2023 10:11:30 +0000 Subject: [PATCH] fix last kamon-akka tests --- .../EventStreamInstrumentation.scala | 30 ++++++++++++++++++ .../EventStreamInstrumentation.scala | 31 +++++++++++++++++++ .../EventStreamInstrumentation.scala | 11 ------- 3 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 instrumentation/kamon-akka/src/common/scala-2/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala create mode 100644 instrumentation/kamon-akka/src/common/scala-3/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala diff --git a/instrumentation/kamon-akka/src/common/scala-2/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala b/instrumentation/kamon-akka/src/common/scala-2/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala new file mode 100644 index 000000000..ca6c11377 --- /dev/null +++ b/instrumentation/kamon-akka/src/common/scala-2/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala @@ -0,0 +1,30 @@ +/* + * ========================================================================================= + * Copyright © 2013-2018 the kamon project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + * ========================================================================================= + */ + +package kamon.instrumentation.akka.instrumentations + +import kanela.agent.api.instrumentation.InstrumentationBuilder + +class EventStreamInstrumentation extends InstrumentationBuilder { + + /** + * Counts dead letters and unhandled messages as they are published on the EventStream. + */ + onType("akka.event.EventStream") + .mixin(classOf[HasSystem.Mixin]) + .advise(isConstructor.and(takesArguments(2)), ConstructorAdvice) + .advise(method("publish").and(takesArguments(1)), PublishMethodAdvice) +} diff --git a/instrumentation/kamon-akka/src/common/scala-3/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala b/instrumentation/kamon-akka/src/common/scala-3/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala new file mode 100644 index 000000000..5217291c2 --- /dev/null +++ b/instrumentation/kamon-akka/src/common/scala-3/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala @@ -0,0 +1,31 @@ +/* + * ========================================================================================= + * Copyright © 2013-2018 the kamon project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + * ========================================================================================= + */ + +package kamon.instrumentation.akka.instrumentations + +import kanela.agent.api.instrumentation.InstrumentationBuilder + +class EventStreamInstrumentation extends InstrumentationBuilder { + + /** + * Counts dead letters and unhandled messages as they are published on the EventStream. + */ + onType("akka.event.EventStream") + .mixin(classOf[HasSystem.Mixin]) + .advise(isConstructor.and(takesArguments(2)), ConstructorAdvice) + onType("akka.event.SubchannelClassification") + .advise(method("publish").and(takesArguments(1)), PublishMethodAdvice) +} diff --git a/instrumentation/kamon-akka/src/common/scala/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala b/instrumentation/kamon-akka/src/common/scala/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala index 7a9bd8490..398cad107 100644 --- a/instrumentation/kamon-akka/src/common/scala/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala +++ b/instrumentation/kamon-akka/src/common/scala/kamon/instrumentation/akka/instrumentations/EventStreamInstrumentation.scala @@ -24,17 +24,6 @@ import kanela.agent.libs.net.bytebuddy.asm.Advice.{Argument, OnMethodExit, This} import scala.annotation.static -class EventStreamInstrumentation extends InstrumentationBuilder { - - /** - * Counts dead letters and unhandled messages as they are published on the EventStream. - */ - onType("akka.event.EventStream") - .mixin(classOf[HasSystem.Mixin]) - .advise(isConstructor.and(takesArguments(2)), ConstructorAdvice) - .advise(method("publish").and(takesArguments(1)), PublishMethodAdvice) -} - class ConstructorAdvice object ConstructorAdvice {