From b421d459e9f280fd5f575d14ba4fa28c4bf9cefe Mon Sep 17 00:00:00 2001 From: Hugh Simpson Date: Thu, 10 Oct 2024 13:10:50 +0100 Subject: [PATCH] annotate some instrumented methods with @noinline --- .../scala/org/apache/pekko/http/impl/engine/http2/Http2.scala | 1 + .../org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala | 1 + 2 files changed, 2 insertions(+) diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala index ea7ede8eb6..aceb16aad0 100644 --- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala +++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2.scala @@ -75,6 +75,7 @@ private[http] final class Http2Ext(implicit val system: ActorSystem) val telemetry = TelemetrySpi.create(system) // TODO: split up similarly to what `Http` does into `serverLayer`, `bindAndHandle`, etc. + @noinline // Not inlined to permit instrumentation to pass params (interface, port) as context to constructed implementation flows def bindAndHandleAsync( handler: HttpRequest => Future[HttpResponse], interface: String, port: Int = DefaultPortForProtocol, diff --git a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala index 09ecf63f44..3b14c0b86b 100644 --- a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala +++ b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Blueprint.scala @@ -296,6 +296,7 @@ private[http] object Http2Blueprint { * Returns a flow that handles `parallelism` requests in parallel, automatically keeping track of the * Http2StreamIdHeader between request and responses. */ + @noinline // Not inlined so that we can instrument the produced flow with e.g. tracing downstream def handleWithStreamIdHeader(parallelism: Int)(handler: HttpRequest => Future[HttpResponse])( implicit ec: ExecutionContext): Flow[HttpRequest, HttpResponse, NotUsed] = Flow[HttpRequest]