diff --git a/otel-extension/src/main/scala/io/scalac/mesmer/otelextension/instrumentations/akka/actor/AkkaMailboxInstrumentations.scala b/otel-extension/src/main/scala/io/scalac/mesmer/otelextension/instrumentations/akka/actor/AkkaMailboxInstrumentations.scala index 4c5dffdc5..265a45e06 100644 --- a/otel-extension/src/main/scala/io/scalac/mesmer/otelextension/instrumentations/akka/actor/AkkaMailboxInstrumentations.scala +++ b/otel-extension/src/main/scala/io/scalac/mesmer/otelextension/instrumentations/akka/actor/AkkaMailboxInstrumentations.scala @@ -1,5 +1,7 @@ package io.scalac.mesmer.otelextension.instrumentations.akka.actor +import java.lang.{ Boolean => JBoolean } + import akka.MesmerMirrorTypes.ActorRefWithCell import akka.MesmerMirrorTypes.Cell import akka.actor.BoundedQueueProxy @@ -31,7 +33,7 @@ object BoundedNodeMessageQueueAdvice { case _: BoundedNodeMessageQueue => incDropped( VirtualField - .find(classOf[AbstractBoundedNodeQueue[_]], classOf[Boolean]) + .find(classOf[AbstractBoundedNodeQueue[_]], classOf[JBoolean]) .get(self.asInstanceOf[AbstractBoundedNodeQueue[_]]), withCell.underlying ) @@ -45,11 +47,10 @@ object BoundedNodeMessageQueueAdvice { @inline private def incDropped(result: Boolean, cell: Cell): Unit = - if (result && (cell ne null)) { + if (!result && (cell ne null)) { val maybeActorMetrics = ActorCellDecorator.getMetrics(cell) for { actorMetrics <- maybeActorMetrics if actorMetrics.droppedMessages.isDefined - } actorMetrics.droppedMessages.get.inc() } } @@ -59,7 +60,7 @@ object AbstractBoundedNodeQueueAdvice { @OnMethodExit def add(@Return result: Boolean, @Advice.This self: Object): Unit = VirtualField - .find(classOf[AbstractBoundedNodeQueue[_]], classOf[Boolean]) + .find(classOf[AbstractBoundedNodeQueue[_]], classOf[JBoolean]) .set(self.asInstanceOf[AbstractBoundedNodeQueue[_]], result) } diff --git a/otel-extension/src/test/scala/io/scalac/mesmer/instrumentation/akka/actor/ActorMailboxTest.scala b/otel-extension/src/test/scala/io/scalac/mesmer/instrumentation/akka/actor/ActorMailboxTest.scala index 5f58f4f56..a89809784 100644 --- a/otel-extension/src/test/scala/io/scalac/mesmer/instrumentation/akka/actor/ActorMailboxTest.scala +++ b/otel-extension/src/test/scala/io/scalac/mesmer/instrumentation/akka/actor/ActorMailboxTest.scala @@ -83,25 +83,25 @@ class ActorMailboxTest | |bounded-node-queue { | mailbox-type = "akka.dispatch.NonBlockingBoundedMailbox" - | mailbox-capacity = 5 + | mailbox-capacity = 3 |} | |bounded-queue { | mailbox-type = "akka.dispatch.BoundedMailbox" | mailbox-push-timeout-time=0 - | mailbox-capacity = 5 + | mailbox-capacity = 3 |} | |bounded-priority-queue { | mailbox-type = "io.scalac.mesmer.instrumentation.akka.actor.HashCodePriorityMailbox" | mailbox-push-timeout-time=1 - | mailbox-capacity = 5 + | mailbox-capacity = 3 |} | |bounded-stable-priority-queue { | mailbox-type = "io.scalac.mesmer.instrumentation.akka.actor.StableHashCodePriorityMailbox" | mailbox-push-timeout-time=1 - | mailbox-capacity = 5 + | mailbox-capacity = 3 |} |""".stripMargin ) @@ -135,7 +135,7 @@ class ActorMailboxTest (sut, context) } - private def testWithProps(props: Props, amountOfMessages: Int = 10, expectedValue: Long = 5): Any = { + private def testWithProps(props: Props, amountOfMessages: Int = 10, expectedValue: Long = 7): Any = { val (sut, context) = actorRefWithContext(props)