diff --git a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/HttpTransferEncodingInstrumentation.java b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/HttpServerConnectionInstrumentation.java similarity index 83% rename from instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/HttpTransferEncodingInstrumentation.java rename to instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/HttpServerConnectionInstrumentation.java index 4f6b6e46b801..ef96d35eaedd 100644 --- a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/HttpTransferEncodingInstrumentation.java +++ b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/HttpServerConnectionInstrumentation.java @@ -7,6 +7,7 @@ import static io.opentelemetry.javaagent.instrumentation.undertow.UndertowSingletons.helper; import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.namedOneOf; import static net.bytebuddy.matcher.ElementMatchers.takesArgument; import io.opentelemetry.context.Context; @@ -18,16 +19,18 @@ import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.matcher.ElementMatcher; -public class HttpTransferEncodingInstrumentation implements TypeInstrumentation { +public class HttpServerConnectionInstrumentation implements TypeInstrumentation { @Override public ElementMatcher typeMatcher() { - return named("io.undertow.server.protocol.http.HttpTransferEncoding"); + return namedOneOf( + "io.undertow.server.protocol.http.HttpServerConnection", + "io.undertow.server.protocol.http2.Http2ServerConnection"); } @Override public void transform(TypeTransformer transformer) { transformer.applyAdviceToMethod( - named("createSinkConduit") + named("getSinkConduit") .and(takesArgument(0, named("io.undertow.server.HttpServerExchange"))), this.getClass().getName() + "$ResponseAdvice"); } diff --git a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowInstrumentationModule.java b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowInstrumentationModule.java index 10871858f449..98b88e2990a0 100644 --- a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowInstrumentationModule.java +++ b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowInstrumentationModule.java @@ -32,6 +32,6 @@ public List typeInstrumentations() { return asList( new HandlerInstrumentation(), new HttpServerExchangeInstrumentation(), - new HttpTransferEncodingInstrumentation()); + new HttpServerConnectionInstrumentation()); } }