Skip to content

Commit 382a324

Browse files
committed
undo http-pipelining changes (will move to another PR)
1 parent 5768f33 commit 382a324

File tree

5 files changed

+12
-30
lines changed

5 files changed

+12
-30
lines changed

instrumentation/pekko/pekko-http-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/PekkoHttpServerTracer.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void onPush() {
101101
if (instrumenter().shouldStart(parentContext, request)) {
102102
Context context = instrumenter().start(parentContext, request);
103103
context = PekkoRouteHolder.init(context);
104-
tracingRequest = new PekkoTracingRequest(context, parentContext, request);
104+
tracingRequest = new PekkoTracingRequest(context, request);
105105
request =
106106
(HttpRequest)
107107
request.addAttribute(PekkoTracingRequest.ATTR_KEY, tracingRequest);
@@ -144,14 +144,6 @@ public void onPush() {
144144
response = (HttpResponse) response.addHeaders(headers);
145145
}
146146

147-
// When GraphInterpreterInstrumentation sets `tracingRequest.context` as the current
148-
// context, the akka Envelope + Actor instrumentation propagates it all the way
149-
// back to here and follows the HttpResponse up the stack of stages.
150-
// If http-pipelining is enabled, it will also propagate this context to the
151-
// handling of the next request, leading to context-leaking errors.
152-
// To prevent this, we reset the context to what it was before creating it.
153-
tracingRequest.parentContext.makeCurrent();
154-
155147
instrumenter().end(tracingRequest.context, tracingRequest.request, response, null);
156148
}
157149
push(responseOut, response);

instrumentation/pekko/pekko-http-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/server/PekkoTracingRequest.java

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,19 @@
55

66
package io.opentelemetry.javaagent.instrumentation.pekkohttp.v1_0.server;
77

8-
import static io.opentelemetry.context.ContextKey.named;
9-
108
import io.opentelemetry.context.Context;
11-
import io.opentelemetry.context.ContextKey;
12-
import io.opentelemetry.context.ImplicitContextKeyed;
139
import org.apache.pekko.http.scaladsl.model.AttributeKey;
1410
import org.apache.pekko.http.scaladsl.model.HttpRequest;
1511

16-
public class PekkoTracingRequest implements ImplicitContextKeyed {
17-
private static final ContextKey<PekkoTracingRequest> CONTEXT_KEY =
18-
named("opentelemetry-pekko-tracing-request");
12+
public class PekkoTracingRequest {
1913
static final AttributeKey<PekkoTracingRequest> ATTR_KEY =
2014
new AttributeKey<>("_otel_ctx", PekkoTracingRequest.class);
21-
static final PekkoTracingRequest EMPTY = new PekkoTracingRequest(null, null, null);
15+
static final PekkoTracingRequest EMPTY = new PekkoTracingRequest(null, null);
2216
final Context context;
23-
final Context parentContext;
2417
final HttpRequest request;
2518

26-
PekkoTracingRequest(Context context, Context parentContext, HttpRequest request) {
19+
PekkoTracingRequest(Context context, HttpRequest request) {
2720
this.context = context;
28-
this.parentContext = parentContext;
2921
this.request = request;
3022
}
31-
32-
@Override
33-
public Context storeInContext(Context context) {
34-
return context.with(CONTEXT_KEY, this);
35-
}
3623
}

instrumentation/pekko/pekko-http-1.0/javaagent/src/test/resources/application.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,4 @@ pekko.http {
88
connecting-timeout = 5s
99
}
1010
}
11-
server {
12-
pipelining-limit = 4 # default is 1
13-
}
1411
}

instrumentation/pekko/pekko-http-1.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/PekkoHttpServerInstrumentationTestAsync.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,11 @@ class PekkoHttpServerInstrumentationTestAsync
2525

2626
override protected def stopServer(server: Object): Unit =
2727
PekkoHttpTestAsyncWebServer.stop()
28+
29+
override protected def configure(
30+
options: HttpServerTestOptions
31+
): Unit = {
32+
super.configure(options)
33+
options.setTestHttpPipelining(false)
34+
}
2835
}

instrumentation/pekko/pekko-http-1.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/pekkohttp/v1_0/PekkoHttpTestAsyncWebServer.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ object PekkoHttpTestAsyncWebServer {
6464
if (null == binding) {
6565
import scala.concurrent.duration._
6666
binding = Await.result(
67-
Http()
68-
.bindAndHandleAsync(asyncHandler, "localhost", port, parallelism = 2),
67+
Http().bindAndHandleAsync(asyncHandler, "localhost", port),
6968
10.seconds
7069
)
7170
}

0 commit comments

Comments
 (0)