Skip to content

Commit be21594

Browse files
authored
Backport: Fix undertow http response customizer with http2 (#11387)
1 parent 0b73c5b commit be21594

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import static io.opentelemetry.javaagent.instrumentation.undertow.UndertowSingletons.helper;
99
import static net.bytebuddy.matcher.ElementMatchers.named;
10+
import static net.bytebuddy.matcher.ElementMatchers.namedOneOf;
1011
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
1112

1213
import io.opentelemetry.context.Context;
@@ -18,16 +19,18 @@
1819
import net.bytebuddy.description.type.TypeDescription;
1920
import net.bytebuddy.matcher.ElementMatcher;
2021

21-
public class HttpTransferEncodingInstrumentation implements TypeInstrumentation {
22+
public class HttpServerConnectionInstrumentation implements TypeInstrumentation {
2223
@Override
2324
public ElementMatcher<TypeDescription> typeMatcher() {
24-
return named("io.undertow.server.protocol.http.HttpTransferEncoding");
25+
return namedOneOf(
26+
"io.undertow.server.protocol.http.HttpServerConnection",
27+
"io.undertow.server.protocol.http2.Http2ServerConnection");
2528
}
2629

2730
@Override
2831
public void transform(TypeTransformer transformer) {
2932
transformer.applyAdviceToMethod(
30-
named("createSinkConduit")
33+
named("getSinkConduit")
3134
.and(takesArgument(0, named("io.undertow.server.HttpServerExchange"))),
3235
this.getClass().getName() + "$ResponseAdvice");
3336
}

instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowInstrumentationModule.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ public List<TypeInstrumentation> typeInstrumentations() {
3232
return asList(
3333
new HandlerInstrumentation(),
3434
new HttpServerExchangeInstrumentation(),
35-
new HttpTransferEncodingInstrumentation());
35+
new HttpServerConnectionInstrumentation());
3636
}
3737
}

0 commit comments

Comments
 (0)