From e0cbf52d1be0c1e19012a1da66a6196241e59c04 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 19 Sep 2024 14:44:53 +0100 Subject: [PATCH] ThreadPoolConfigCopyAdvice often sets null prereqs --- .../pekko/instrumentations/DispatcherInstrumentation.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/instrumentation/kamon-pekko/src/main/scala/kamon/instrumentation/pekko/instrumentations/DispatcherInstrumentation.scala b/instrumentation/kamon-pekko/src/main/scala/kamon/instrumentation/pekko/instrumentations/DispatcherInstrumentation.scala index b2c3a7454..ee8da0bd9 100644 --- a/instrumentation/kamon-pekko/src/main/scala/kamon/instrumentation/pekko/instrumentations/DispatcherInstrumentation.scala +++ b/instrumentation/kamon-pekko/src/main/scala/kamon/instrumentation/pekko/instrumentations/DispatcherInstrumentation.scala @@ -167,9 +167,10 @@ object ThreadPoolConfigCopyAdvice { @Advice.OnMethodExit @static def exit(@Advice.This original: Any, @Advice.Return copy: Any): Unit = { - copy.asInstanceOf[HasDispatcherPrerequisites].setDispatcherPrerequisites( - original.asInstanceOf[HasDispatcherPrerequisites].dispatcherPrerequisites - ) + val prereqs = original.asInstanceOf[HasDispatcherPrerequisites].dispatcherPrerequisites + if (prereqs != null) { + copy.asInstanceOf[HasDispatcherPrerequisites].setDispatcherPrerequisites(prereqs) + } copy.asInstanceOf[HasDispatcherName].setDispatcherName(original.asInstanceOf[HasDispatcherName].dispatcherName) } }