Skip to content

Commit a478d3b

Browse files
authored
make kamon-pekko tolerant of null dispatcherPrerequisites (#1361)
OK let's just get this in for now and I'll work on the instrumentation again today and hope I make better progress 😅
1 parent 124e223 commit a478d3b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

instrumentation/kamon-pekko/src/main/scala/kamon/instrumentation/pekko/instrumentations/DispatcherInstrumentation.scala

+7-2
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,18 @@ object InstrumentNewExecutorServiceOnPekko {
127127
@SuperCall callable: Callable[ExecutorService]
128128
): ExecutorService = {
129129
val executor = callable.call()
130-
val actorSystemName = factory.dispatcherPrerequisites.settings.name
130+
val actorSystemName = if (factory.dispatcherPrerequisites != null) {
131+
factory.dispatcherPrerequisites.settings.name
132+
} else {
133+
"unknown"
134+
}
131135
val dispatcherName = factory.dispatcherName
132136
val scheduledActionName = actorSystemName + "/" + dispatcherName
133137
val systemTags = TagSet.of("pekko.system", actorSystemName)
134138

135139
if (Kamon.filter(PekkoInstrumentation.TrackDispatcherFilterName).accept(dispatcherName)) {
136-
val defaultEcOption = factory.dispatcherPrerequisites.defaultExecutionContext
140+
val defaultEcOption = Option(factory.dispatcherPrerequisites)
141+
.flatMap(_.defaultExecutionContext)
137142

138143
if (dispatcherName == Dispatchers.DefaultDispatcherId && defaultEcOption.isDefined) {
139144
ExecutorInstrumentation.instrumentExecutionContext(

0 commit comments

Comments
 (0)