Skip to content

Commit

Permalink
kamon-pekko: reorder some code to avoid unnecessary eval (#1364)
Browse files Browse the repository at this point in the history
reorder akka code too
  • Loading branch information
pjfanning authored Oct 10, 2024
1 parent ff8c1b3 commit 28e2310
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,12 @@ object InstrumentNewExecutorServiceOnAkka24 {

def around(@This factory: HasDispatcherPrerequisites with HasDispatcherName, @SuperCall callable: Callable[ExecutorService]): ExecutorService = {
val executor = callable.call()
val actorSystemName = factory.dispatcherPrerequisites.settings.name
val dispatcherName = factory.dispatcherName
val scheduledActionName = actorSystemName + "/" + dispatcherName
val systemTags = TagSet.of("akka.system", actorSystemName)


if(Kamon.filter(AkkaInstrumentation.TrackDispatcherFilterName).accept(dispatcherName)) {
val actorSystemName = factory.dispatcherPrerequisites.settings.name
val scheduledActionName = actorSystemName + "/" + dispatcherName
val systemTags = TagSet.of("akka.system", actorSystemName)
val defaultEcOption = factory.dispatcherPrerequisites.defaultExecutionContext

if(dispatcherName == Dispatchers.DefaultDispatcherId && defaultEcOption.isDefined) {
Expand All @@ -142,12 +141,12 @@ object InstrumentNewExecutorServiceOnAkka25 {

def around(@This factory: HasDispatcherPrerequisites with HasDispatcherName, @SuperCall callable: Callable[ExecutorService]): ExecutorService = {
val executor = callable.call()
val actorSystemName = factory.dispatcherPrerequisites.settings.name
val dispatcherName = factory.dispatcherName
val scheduledActionName = actorSystemName + "/" + dispatcherName
val systemTags = TagSet.of("akka.system", actorSystemName)

if(Kamon.filter(AkkaInstrumentation.TrackDispatcherFilterName).accept(dispatcherName)) {
val actorSystemName = factory.dispatcherPrerequisites.settings.name
val scheduledActionName = actorSystemName + "/" + dispatcherName
val systemTags = TagSet.of("akka.system", actorSystemName)
val defaultEcOption = factory.dispatcherPrerequisites.defaultExecutionContext

if(dispatcherName == Dispatchers.DefaultDispatcherId && defaultEcOption.isDefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ object InstrumentNewExecutorServiceOnAkka26 {

@static def around(@This factory: HasDispatcherPrerequisites with HasDispatcherName, @SuperCall callable: Callable[ExecutorService]): ExecutorService = {
val executor = callable.call()
val actorSystemName = factory.dispatcherPrerequisites.settings.name
val dispatcherName = factory.dispatcherName
val scheduledActionName = actorSystemName + "/" + dispatcherName
val systemTags = TagSet.of("akka.system", actorSystemName)

if(Kamon.filter(AkkaInstrumentation.TrackDispatcherFilterName).accept(dispatcherName)) {
val actorSystemName = factory.dispatcherPrerequisites.settings.name
val scheduledActionName = actorSystemName + "/" + dispatcherName
val systemTags = TagSet.of("akka.system", actorSystemName)
val defaultEcOption = factory.dispatcherPrerequisites.defaultExecutionContext

if(dispatcherName == Dispatchers.DefaultDispatcherId && defaultEcOption.isDefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,16 @@ object InstrumentNewExecutorServiceOnPekko {
@SuperCall callable: Callable[ExecutorService]
): ExecutorService = {
val executor = callable.call()
val actorSystemName = if (factory.dispatcherPrerequisites != null) {
factory.dispatcherPrerequisites.settings.name
} else {
"unknown"
}
val dispatcherName = factory.dispatcherName
val scheduledActionName = actorSystemName + "/" + dispatcherName
val systemTags = TagSet.of("pekko.system", actorSystemName)

if (Kamon.filter(PekkoInstrumentation.TrackDispatcherFilterName).accept(dispatcherName)) {
val actorSystemName = if (factory.dispatcherPrerequisites != null) {
factory.dispatcherPrerequisites.settings.name
} else {
"unknown"
}
val scheduledActionName = actorSystemName + "/" + dispatcherName
val systemTags = TagSet.of("pekko.system", actorSystemName)
val defaultEcOption = Option(factory.dispatcherPrerequisites)
.flatMap(_.defaultExecutionContext)

Expand Down

0 comments on commit 28e2310

Please sign in to comment.