diff --git a/README.md b/README.md index eeabbf6991..c4adb38c8c 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,8 @@ provide the path to a JAR file including an SPI implementation using the system | [Finatra](https://github.com/twitter/finatra) | 2.9+ | | [Geode Client](https://geode.apache.org/) | 1.4+ | | [Google HTTP Client](https://github.com/googleapis/google-http-java-client) | 1.19+ | -| [Grizzly](https://javaee.github.io/grizzly/httpserverframework.html) | 2.0+ (disabled by default, see below) | +| [Grizzly](https://javaee.github.io/grizzly/httpserverframework.html) | 2.0+ (disabled by default, see below) | +| [Grizzly Client](https://github.com/javaee/grizzly-ahc) | 1.9+ | | [gRPC](https://github.com/grpc/grpc-java) | 1.5+ | | [Hibernate](https://github.com/hibernate/hibernate-orm) | 3.3+ | | [HttpURLConnection](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/HttpURLConnection.html) | Java 7+ | diff --git a/instrumentation/grizzly-2.0/grizzly-2.0.gradle b/instrumentation/grizzly-2.0/grizzly-2.0.gradle index 80f16c4230..4e3e1a4a34 100644 --- a/instrumentation/grizzly-2.0/grizzly-2.0.gradle +++ b/instrumentation/grizzly-2.0/grizzly-2.0.gradle @@ -21,6 +21,8 @@ testSets { dependencies { compileOnly group: 'org.glassfish.grizzly', name: 'grizzly-http-server', version: '2.0' + compile project(':instrumentation:grizzly-http-2.0') + testCompile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.3' testCompile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0' testCompile group: 'org.glassfish.grizzly', name: 'grizzly-http-server', version: '2.0' diff --git a/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyHttpHandlerInstrumentation.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyHttpHandlerInstrumentation.java deleted file mode 100644 index ad6f0413b1..0000000000 --- a/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyHttpHandlerInstrumentation.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.opentelemetry.auto.instrumentation.grizzly; - -import static io.opentelemetry.auto.bootstrap.instrumentation.decorator.HttpServerTracer.CONTEXT_ATTRIBUTE; -import static io.opentelemetry.auto.instrumentation.grizzly.GrizzlyHttpServerTracer.TRACER; -import static io.opentelemetry.trace.TracingContextUtils.getSpan; -import static java.util.Collections.singletonMap; -import static net.bytebuddy.matcher.ElementMatchers.isMethod; -import static net.bytebuddy.matcher.ElementMatchers.named; -import static net.bytebuddy.matcher.ElementMatchers.takesArgument; - -import com.google.auto.service.AutoService; -import io.grpc.Context; -import io.opentelemetry.auto.tooling.Instrumenter; -import io.opentelemetry.context.Scope; -import io.opentelemetry.trace.Span; -import java.lang.reflect.Method; -import java.util.Map; -import net.bytebuddy.asm.Advice; -import net.bytebuddy.description.method.MethodDescription; -import net.bytebuddy.description.type.TypeDescription; -import net.bytebuddy.matcher.ElementMatcher; -import org.glassfish.grizzly.http.server.AfterServiceListener; -import org.glassfish.grizzly.http.server.Request; -import org.glassfish.grizzly.http.server.Response; - -@AutoService(Instrumenter.class) -public class GrizzlyHttpHandlerInstrumentation extends Instrumenter.Default { - - public GrizzlyHttpHandlerInstrumentation() { - super("grizzly"); - } - - @Override - protected boolean defaultEnabled() { - return false; - } - - @Override - public ElementMatcher typeMatcher() { - return named("org.glassfish.grizzly.http.server.HttpHandler"); - } - - @Override - public String[] helperClassNames() { - return new String[] { - packageName + ".GrizzlyHttpServerTracer", - packageName + ".GrizzlyRequestExtractAdapter", - getClass().getName() + "$SpanClosingListener" - }; - } - - @Override - public Map, String> transformers() { - return singletonMap( - isMethod() - .and(named("doHandle")) - .and(takesArgument(0, named("org.glassfish.grizzly.http.server.Request"))) - .and(takesArgument(1, named("org.glassfish.grizzly.http.server.Response"))), - GrizzlyHttpHandlerInstrumentation.class.getName() + "$HandleAdvice"); - } - - public static class HandleAdvice { - @Advice.OnMethodEnter(suppress = Throwable.class) - public static void methodEnter( - @Advice.Origin final Method method, - @Advice.Argument(0) final Request request, - @Advice.Local("otelSpan") Span span, - @Advice.Local("otelScope") Scope scope) { - if (TRACER.getAttachedContext(request) != null) { - return; - } - - request.addAfterServiceListener(SpanClosingListener.LISTENER); - - span = TRACER.startSpan(request, method, null); - scope = TRACER.startScope(span, request); - } - - @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) - public static void methodExit( - @Advice.Argument(1) final Response response, - @Advice.Thrown final Throwable throwable, - @Advice.Local("otelSpan") Span span, - @Advice.Local("otelScope") Scope scope) { - if (scope == null) { - return; - } - scope.close(); - - if (throwable != null) { - TRACER.endExceptionally(span, throwable, response.getStatus()); - } - } - } - - public static class SpanClosingListener implements AfterServiceListener { - public static final SpanClosingListener LISTENER = new SpanClosingListener(); - - @Override - public void onAfterService(final Request request) { - final Object contextAttribute = request.getAttribute(CONTEXT_ATTRIBUTE); - if (contextAttribute instanceof Context) { - request.removeAttribute(CONTEXT_ATTRIBUTE); - TRACER.end(getSpan((Context) contextAttribute), request.getResponse().getStatus()); - } - } - } -} diff --git a/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyHttpServerTracer.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyHttpServerTracer.java deleted file mode 100644 index b951db7be0..0000000000 --- a/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyHttpServerTracer.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.opentelemetry.auto.instrumentation.grizzly; - -import static io.opentelemetry.auto.instrumentation.grizzly.GrizzlyRequestExtractAdapter.GETTER; - -import io.grpc.Context; -import io.opentelemetry.auto.bootstrap.instrumentation.decorator.HttpServerTracer; -import io.opentelemetry.context.propagation.HttpTextFormat.Getter; -import io.opentelemetry.trace.Span; -import java.net.URI; -import java.net.URISyntaxException; -import org.glassfish.grizzly.http.server.Request; - -public class GrizzlyHttpServerTracer extends HttpServerTracer { - public static final GrizzlyHttpServerTracer TRACER = new GrizzlyHttpServerTracer(); - - @Override - protected String getVersion() { - return null; - } - - @Override - protected String getInstrumentationName() { - return "io.opentelemetry.auto.grizzly-2.0"; - } - - @Override - protected Integer peerPort(Request request) { - return request.getRemotePort(); - } - - @Override - protected String peerHostIP(Request request) { - return request.getRemoteAddr(); - } - - @Override - protected void attachContextToRequest(Context context, Request request) { - request.setAttribute(CONTEXT_ATTRIBUTE, context); - } - - @Override - public Context getAttachedContext(Request request) { - Object context = request.getAttribute(CONTEXT_ATTRIBUTE); - return context instanceof Context ? (Context) context : null; - } - - @Override - protected URI url(Request request) throws URISyntaxException { - return new URI( - request.getScheme(), - null, - request.getServerName(), - request.getServerPort(), - request.getRequestURI(), - request.getQueryString(), - null); - } - - @Override - protected String method(Request request) { - return request.getMethod().getMethodString(); - } - - @Override - protected Getter getGetter() { - return GETTER; - } - - @Override - public void onRequest(Span span, Request request) { - request.setAttribute("traceId", span.getContext().getTraceId().toLowerBase16()); - request.setAttribute("spanId", span.getContext().getSpanId().toLowerBase16()); - super.onRequest(span, request); - } -} diff --git a/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyRequestExtractAdapter.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyRequestExtractAdapter.java deleted file mode 100644 index cac55a2562..0000000000 --- a/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyRequestExtractAdapter.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.opentelemetry.auto.instrumentation.grizzly; - -import io.opentelemetry.context.propagation.HttpTextFormat; -import org.glassfish.grizzly.http.server.Request; - -public class GrizzlyRequestExtractAdapter implements HttpTextFormat.Getter { - - public static final GrizzlyRequestExtractAdapter GETTER = new GrizzlyRequestExtractAdapter(); - - @Override - public String get(final Request carrier, final String key) { - return carrier.getHeader(key); - } -} diff --git a/instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyFilterchainServerTestInstrumentation.java b/instrumentation/grizzly-2.0/src/test/groovy/GrizzlyFilterchainServerTestInstrumentation.java similarity index 100% rename from instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyFilterchainServerTestInstrumentation.java rename to instrumentation/grizzly-2.0/src/test/groovy/GrizzlyFilterchainServerTestInstrumentation.java diff --git a/instrumentation/grizzly-2.0/src/test/groovy/GrizzlyTest.groovy b/instrumentation/grizzly-2.0/src/test/groovy/GrizzlyTest.groovy index e254941a64..467d477dff 100644 --- a/instrumentation/grizzly-2.0/src/test/groovy/GrizzlyTest.groovy +++ b/instrumentation/grizzly-2.0/src/test/groovy/GrizzlyTest.groovy @@ -15,15 +15,16 @@ */ import io.opentelemetry.auto.test.base.HttpServerTest +import org.glassfish.grizzly.http.server.HttpServer +import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory +import org.glassfish.jersey.server.ResourceConfig + import javax.ws.rs.GET import javax.ws.rs.NotFoundException import javax.ws.rs.Path import javax.ws.rs.QueryParam import javax.ws.rs.core.Response import javax.ws.rs.ext.ExceptionMapper -import org.glassfish.grizzly.http.server.HttpServer -import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory -import org.glassfish.jersey.server.ResourceConfig import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.ERROR import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.EXCEPTION @@ -105,9 +106,4 @@ class GrizzlyTest extends HttpServerTest { return null } } - - @Override - String expectedOperationName(String method, ServerEndpoint serverEndpoint) { - return 'HttpHandler.doHandle' - } } diff --git a/instrumentation/grizzly-http-2.3/grizzly-http-2.3.gradle b/instrumentation/grizzly-http-2.0/grizzly-http-2.0.gradle similarity index 92% rename from instrumentation/grizzly-http-2.3/grizzly-http-2.3.gradle rename to instrumentation/grizzly-http-2.0/grizzly-http-2.0.gradle index 4768a82e20..cf47173ac2 100644 --- a/instrumentation/grizzly-http-2.3/grizzly-http-2.3.gradle +++ b/instrumentation/grizzly-http-2.0/grizzly-http-2.0.gradle @@ -5,7 +5,8 @@ muzzle { pass { group = "org.glassfish.grizzly" module = 'grizzly-http' - versions = "[2.3,)" + versions = "[2.0,)" + assertInverse = true } } @@ -17,7 +18,7 @@ testSets { dependencies { - compileOnly group: 'org.glassfish.grizzly', name: 'grizzly-http', version: '2.3' + compileOnly group: 'org.glassfish.grizzly', name: 'grizzly-http', version: '2.0' testCompile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.3' testCompile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0' diff --git a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/DefaultFilterChainAdvice.java b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainAdvice.java similarity index 93% rename from instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/DefaultFilterChainAdvice.java rename to instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainAdvice.java index 49d221e4a0..7cceaf58f3 100644 --- a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/DefaultFilterChainAdvice.java +++ b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainAdvice.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.auto.instrumentation.grizzly.http.v2_3; +package io.opentelemetry.auto.instrumentation.grizzly; import net.bytebuddy.asm.Advice; import org.glassfish.grizzly.filterchain.FilterChainContext; diff --git a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/DefaultFilterChainInstrumentation.java b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainInstrumentation.java similarity index 95% rename from instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/DefaultFilterChainInstrumentation.java rename to instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainInstrumentation.java index ef7e740da4..11c2c7febf 100644 --- a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/DefaultFilterChainInstrumentation.java +++ b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainInstrumentation.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.auto.instrumentation.grizzly.http.v2_3; +package io.opentelemetry.auto.instrumentation.grizzly; import static net.bytebuddy.matcher.ElementMatchers.isMethod; import static net.bytebuddy.matcher.ElementMatchers.isPrivate; @@ -33,7 +33,7 @@ import net.bytebuddy.matcher.ElementMatcher; public class DefaultFilterChainInstrumentation extends Instrumenter.Default { public DefaultFilterChainInstrumentation() { - super("grizzly-filterchain"); + super("grizzly"); } @Override diff --git a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/ExtractAdapter.java b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/ExtractAdapter.java similarity index 93% rename from instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/ExtractAdapter.java rename to instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/ExtractAdapter.java index e86d148d4e..d05da097f8 100644 --- a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/ExtractAdapter.java +++ b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/ExtractAdapter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.auto.instrumentation.grizzly.http.v2_3; +package io.opentelemetry.auto.instrumentation.grizzly; import io.opentelemetry.context.propagation.HttpTextFormat; import org.glassfish.grizzly.http.HttpHeader; diff --git a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/FilterAdvice.java b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterAdvice.java similarity index 91% rename from instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/FilterAdvice.java rename to instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterAdvice.java index 5b205680fc..9b2006515e 100644 --- a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/FilterAdvice.java +++ b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterAdvice.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.opentelemetry.auto.instrumentation.grizzly.http.v2_3; +package io.opentelemetry.auto.instrumentation.grizzly; -import static io.opentelemetry.auto.instrumentation.grizzly.http.v2_3.GrizzlyDecorator.TRACER; +import static io.opentelemetry.auto.instrumentation.grizzly.GrizzlyDecorator.TRACER; import static io.opentelemetry.context.ContextUtils.withScopedContext; import io.grpc.Context; diff --git a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/FilterInstrumentation.java b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterInstrumentation.java similarity index 94% rename from instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/FilterInstrumentation.java rename to instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterInstrumentation.java index f22e18ad47..0081047d3a 100644 --- a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/FilterInstrumentation.java +++ b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterInstrumentation.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.auto.instrumentation.grizzly.http.v2_3; +package io.opentelemetry.auto.instrumentation.grizzly; import static io.opentelemetry.auto.tooling.ClassLoaderMatcher.hasClassesNamed; import static java.util.Collections.singletonMap; @@ -36,7 +36,7 @@ import net.bytebuddy.matcher.ElementMatchers; public final class FilterInstrumentation extends Instrumenter.Default { public FilterInstrumentation() { - super("grizzly-filterchain"); + super("grizzly"); } @Override @@ -63,6 +63,11 @@ public final class FilterInstrumentation extends Instrumenter.Default { return new String[] {packageName + ".GrizzlyDecorator", packageName + ".ExtractAdapter"}; } + @Override + protected boolean defaultEnabled() { + return false; + } + @Override public Map, String> transformers() { return singletonMap( diff --git a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/GrizzlyDecorator.java b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyDecorator.java similarity index 98% rename from instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/GrizzlyDecorator.java rename to instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyDecorator.java index 39e22c8d5d..b3abe21d90 100644 --- a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/GrizzlyDecorator.java +++ b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyDecorator.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.auto.instrumentation.grizzly.http.v2_3; +package io.opentelemetry.auto.instrumentation.grizzly; import static io.opentelemetry.auto.bootstrap.instrumentation.decorator.HttpServerTracer.CONTEXT_ATTRIBUTE; import static io.opentelemetry.trace.Span.Kind.SERVER; diff --git a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpCodecFilterAdvice.java b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterAdvice.java similarity index 94% rename from instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpCodecFilterAdvice.java rename to instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterAdvice.java index a729bb585c..c2155d894f 100644 --- a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpCodecFilterAdvice.java +++ b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterAdvice.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.auto.instrumentation.grizzly.http.v2_3; +package io.opentelemetry.auto.instrumentation.grizzly; import net.bytebuddy.asm.Advice; import org.glassfish.grizzly.filterchain.FilterChainContext; diff --git a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpCodecFilterInstrumentation.java b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterInstrumentation.java similarity index 96% rename from instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpCodecFilterInstrumentation.java rename to instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterInstrumentation.java index ecfa74be87..f1a521ea69 100644 --- a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpCodecFilterInstrumentation.java +++ b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterInstrumentation.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.auto.instrumentation.grizzly.http.v2_3; +package io.opentelemetry.auto.instrumentation.grizzly; import static net.bytebuddy.matcher.ElementMatchers.isPublic; import static net.bytebuddy.matcher.ElementMatchers.named; @@ -32,7 +32,7 @@ import net.bytebuddy.matcher.ElementMatcher; public final class HttpCodecFilterInstrumentation extends Instrumenter.Default { public HttpCodecFilterInstrumentation() { - super("grizzly-filterchain"); + super("grizzly"); } @Override diff --git a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpCodecFilterOldAdvice.java b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterOldAdvice.java similarity index 94% rename from instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpCodecFilterOldAdvice.java rename to instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterOldAdvice.java index 3e9e68390f..3e27a82523 100644 --- a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpCodecFilterOldAdvice.java +++ b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterOldAdvice.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.auto.instrumentation.grizzly.http.v2_3; +package io.opentelemetry.auto.instrumentation.grizzly; import net.bytebuddy.asm.Advice; import org.glassfish.grizzly.filterchain.FilterChainContext; diff --git a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpServerFilterAdvice.java b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterAdvice.java similarity index 94% rename from instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpServerFilterAdvice.java rename to instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterAdvice.java index 40604b283c..c73eaa2756 100644 --- a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpServerFilterAdvice.java +++ b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterAdvice.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.auto.instrumentation.grizzly.http.v2_3; +package io.opentelemetry.auto.instrumentation.grizzly; import net.bytebuddy.asm.Advice; import org.glassfish.grizzly.filterchain.FilterChainContext; diff --git a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpServerFilterInstrumentation.java b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterInstrumentation.java similarity index 95% rename from instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpServerFilterInstrumentation.java rename to instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterInstrumentation.java index 5ecda08f3b..c13b6fc783 100644 --- a/instrumentation/grizzly-http-2.3/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/http/v2_3/HttpServerFilterInstrumentation.java +++ b/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterInstrumentation.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.opentelemetry.auto.instrumentation.grizzly.http.v2_3; +package io.opentelemetry.auto.instrumentation.grizzly; import static net.bytebuddy.matcher.ElementMatchers.isPrivate; import static net.bytebuddy.matcher.ElementMatchers.named; @@ -32,7 +32,7 @@ import net.bytebuddy.matcher.ElementMatcher; public class HttpServerFilterInstrumentation extends Instrumenter.Default { public HttpServerFilterInstrumentation() { - super("grizzly-filterchain"); + super("grizzly"); } @Override diff --git a/instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyAsyncTest.groovy b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyAsyncTest.groovy similarity index 100% rename from instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyAsyncTest.groovy rename to instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyAsyncTest.groovy diff --git a/instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyFilterchainServerTest.groovy b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyFilterchainServerTest.groovy similarity index 98% rename from instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyFilterchainServerTest.groovy rename to instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyFilterchainServerTest.groovy index 22e3355bd1..75be4d97ca 100644 --- a/instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyFilterchainServerTest.groovy +++ b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyFilterchainServerTest.groovy @@ -51,7 +51,7 @@ import static org.glassfish.grizzly.memory.Buffers.wrap class GrizzlyFilterchainServerTest extends HttpServerTest { static { - System.setProperty("ota.integration.grizzly-filterchain.enabled", "true") + System.setProperty("ota.integration.grizzly.enabled", "true") } private TCPNIOTransport transport diff --git a/instrumentation/grizzly-2.0/src/test/groovy/GrizzlyTestInstrumentation.java b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyFilterchainServerTestInstrumentation.java similarity index 67% rename from instrumentation/grizzly-2.0/src/test/groovy/GrizzlyTestInstrumentation.java rename to instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyFilterchainServerTestInstrumentation.java index 8b8a02cc71..70b203a92c 100644 --- a/instrumentation/grizzly-2.0/src/test/groovy/GrizzlyTestInstrumentation.java +++ b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyFilterchainServerTestInstrumentation.java @@ -15,6 +15,7 @@ */ import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArgument; import com.google.auto.service.AutoService; import io.opentelemetry.auto.test.base.HttpServerTestAdvice; @@ -22,14 +23,19 @@ import io.opentelemetry.auto.tooling.Instrumenter; import net.bytebuddy.agent.builder.AgentBuilder; @AutoService(Instrumenter.class) -public class GrizzlyTestInstrumentation implements Instrumenter { +public class GrizzlyFilterchainServerTestInstrumentation implements Instrumenter { @Override public AgentBuilder instrument(final AgentBuilder agentBuilder) { return agentBuilder - .type(named("org.glassfish.grizzly.http.server.HttpHandlerChain")) + .type(named("org.glassfish.grizzly.http.HttpCodecFilter")) .transform( new AgentBuilder.Transformer.ForAdvice() - .advice(named("doHandle"), HttpServerTestAdvice.ServerEntryAdvice.class.getName())); + .advice( + named("handleRead") + .and( + takesArgument( + 0, named("org.glassfish.grizzly.filterchain.FilterChainContext"))), + HttpServerTestAdvice.ServerEntryAdvice.class.getName())); } } diff --git a/instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyIOStrategyTest.groovy b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyIOStrategyTest.groovy similarity index 100% rename from instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyIOStrategyTest.groovy rename to instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyIOStrategyTest.groovy diff --git a/instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyTest.groovy b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyTest.groovy similarity index 97% rename from instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyTest.groovy rename to instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyTest.groovy index 4576dc40f7..467d477dff 100644 --- a/instrumentation/grizzly-http-2.3/src/test/groovy/GrizzlyTest.groovy +++ b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyTest.groovy @@ -35,7 +35,7 @@ import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.SUCC class GrizzlyTest extends HttpServerTest { static { - System.setProperty("ota.integration.grizzly-filterchain.enabled", "true") + System.setProperty("ota.integration.grizzly.enabled", "true") } @Override diff --git a/settings.gradle b/settings.gradle index b708bb8312..ec635245cb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -68,7 +68,7 @@ include ':instrumentation:geode-1.4' include ':instrumentation:google-http-client-1.19' include ':instrumentation:grizzly-2.0' include ':instrumentation:grizzly-client-1.9' -include ':instrumentation:grizzly-http-2.3' +include ':instrumentation:grizzly-http-2.0' include ':instrumentation:grpc-1.5' include ':instrumentation:hibernate:hibernate-3.3' include ':instrumentation:hibernate:hibernate-4.0'