Skip to content

Commit

Permalink
make kamon-pekko tolerant of null dispatcherPrerequisites (#1361)
Browse files Browse the repository at this point in the history
OK let's just get this in for now and I'll work on the instrumentation again today and hope I make better progress 😅
  • Loading branch information
pjfanning authored Sep 17, 2024
1 parent 124e223 commit a478d3b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,18 @@ object InstrumentNewExecutorServiceOnPekko {
@SuperCall callable: Callable[ExecutorService]
): ExecutorService = {
val executor = callable.call()
val actorSystemName = factory.dispatcherPrerequisites.settings.name
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 defaultEcOption = factory.dispatcherPrerequisites.defaultExecutionContext
val defaultEcOption = Option(factory.dispatcherPrerequisites)
.flatMap(_.defaultExecutionContext)

if (dispatcherName == Dispatchers.DefaultDispatcherId && defaultEcOption.isDefined) {
ExecutorInstrumentation.instrumentExecutionContext(
Expand Down

0 comments on commit a478d3b

Please sign in to comment.