This is an automated email from the ASF dual-hosted git repository.

fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git


The following commit(s) were added to refs/heads/main by this push:
     new c3999a0df4 Fix downstream kamon instrumentation (#1489)
c3999a0df4 is described below

commit c3999a0df4f6c30e773102b1a3b4e7edafdb6f72
Author: hughsimpson <[email protected]>
AuthorDate: Sat Sep 21 14:00:43 2024 +0100

    Fix downstream kamon instrumentation (#1489)
    
    * add @noinline annotation to MessageBuffer.Node.apply
    
    * add @noinline annotation to Envelope.copy
    
    * add overriding defn of copy with @noinline annotation to ThreadPoolConfig
    
    * add comments
---
 .../org/apache/pekko/dispatch/AbstractDispatcher.scala      |  1 +
 .../scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala | 13 +++++++++++++
 .../main/scala/org/apache/pekko/util/MessageBuffer.scala    |  1 +
 3 files changed, 15 insertions(+)

diff --git 
a/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala 
b/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala
index f163f01960..f2d6aa8d56 100644
--- a/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala
+++ b/actor/src/main/scala/org/apache/pekko/dispatch/AbstractDispatcher.scala
@@ -34,6 +34,7 @@ import com.typesafe.config.Config
 
 final case class Envelope private (message: Any, sender: ActorRef) {
 
+  @noinline // not inlined to permit downstream bytecode instrumentation to 
attach context information to the Envelope
   def copy(message: Any = message, sender: ActorRef = sender) = {
     Envelope(message, sender)
   }
diff --git 
a/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala 
b/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala
index b11f9aa42a..205c2e4ac7 100644
--- a/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala
+++ b/actor/src/main/scala/org/apache/pekko/dispatch/ThreadPoolBuilder.scala
@@ -85,6 +85,19 @@ final case class ThreadPoolConfig(
     queueFactory: ThreadPoolConfig.QueueFactory = 
ThreadPoolConfig.linkedBlockingQueue(),
     rejectionPolicy: RejectedExecutionHandler = 
ThreadPoolConfig.defaultRejectionPolicy)
     extends ExecutorServiceFactoryProvider {
+  // Written explicitly to permit non-inlined defn; this is necessary for 
downstream instrumentation that stores extra
+  // context information on the config
+  @noinline
+  def copy(
+      allowCorePoolTimeout: Boolean = allowCorePoolTimeout,
+      corePoolSize: Int = corePoolSize,
+      maxPoolSize: Int = maxPoolSize,
+      threadTimeout: Duration = threadTimeout,
+      queueFactory: ThreadPoolConfig.QueueFactory = queueFactory,
+      rejectionPolicy: RejectedExecutionHandler = rejectionPolicy
+  ): ThreadPoolConfig =
+    ThreadPoolConfig(allowCorePoolTimeout, corePoolSize, maxPoolSize, 
threadTimeout, queueFactory, rejectionPolicy)
+
   class ThreadPoolExecutorServiceFactory(val threadFactory: ThreadFactory) 
extends ExecutorServiceFactory {
     def createExecutorService: ExecutorService = {
       val service: ThreadPoolExecutor = new ThreadPoolExecutor(
diff --git a/actor/src/main/scala/org/apache/pekko/util/MessageBuffer.scala 
b/actor/src/main/scala/org/apache/pekko/util/MessageBuffer.scala
index b718a52d1f..3b61ac637c 100644
--- a/actor/src/main/scala/org/apache/pekko/util/MessageBuffer.scala
+++ b/actor/src/main/scala/org/apache/pekko/util/MessageBuffer.scala
@@ -160,6 +160,7 @@ final class MessageBuffer private (private var _head: 
MessageBuffer.Node, privat
 
 object MessageBuffer {
   private final class Node(var next: Node, val message: Any, val ref: 
ActorRef) {
+    @noinline // not inlined to permit downstream bytecode instrumentation to 
apply context information on the Node to the message
     def apply(f: (Any, ActorRef) => Unit): Unit = {
       f(message, ref)
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to