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

kamon-pekko: reorder some code to avoid unnecessary eval #1364

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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