-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
514 - bring back mailbox size metric
- Loading branch information
1 parent
5d8d8d4
commit 176899f
Showing
6 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
otel-extension/src/main/java/akka/actor/impl/MailboxEnqueueAdvice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package akka.actor.impl; | ||
|
||
import akka.actor.ActorContext; | ||
import akka.dispatch.Mailbox; | ||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.instrumentation.api.field.VirtualField; | ||
import io.scalac.mesmer.otelextension.instrumentations.akka.actor.Instruments; | ||
import io.scalac.mesmer.otelextension.instrumentations.akka.actor.InstrumentsProvider; | ||
import net.bytebuddy.asm.Advice; | ||
|
||
import java.util.Objects; | ||
|
||
public class MailboxEnqueueAdvice { | ||
|
||
@Advice.OnMethodExit | ||
public static void exit(@Advice.This Mailbox self) { | ||
if (Objects.nonNull(self.actor()) | ||
&& Objects.nonNull(self.actor().getSystem())) { | ||
Attributes attrs = VirtualField.find(ActorContext.class, Attributes.class).get(self.actor()); | ||
Instruments instruments = InstrumentsProvider.instance(); | ||
|
||
if (Objects.nonNull(attrs)) { | ||
instruments.mailboxSize().add(1, attrs); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters