Rename grizzly-client instrumentation (#1709)
* Rename grizzly-client instrumentation
This commit is contained in:
parent
e9821e9cd1
commit
081e142718
|
@ -217,6 +217,7 @@ Because the automatic instrumentation runs in a different classpath than the ins
|
|||
| [Apache HttpAsyncClient](https://hc.apache.org/index.html) | 4.0+ |
|
||||
| [Apache HttpClient](https://hc.apache.org/index.html) | 2.0+ |
|
||||
| [Armeria](https://armeria.dev) | 0.99.8+ |
|
||||
| [AsyncHttpClient](https://github.com/AsyncHttpClient/async-http-client) | 1.9+ (not including 2.x yet) |
|
||||
| [AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/java-handler.html) | 1.0+ |
|
||||
| [AWS SDK](https://aws.amazon.com/sdk-for-java/) | 1.11.x and 2.2.0+ |
|
||||
| [Cassandra Driver](https://github.com/datastax/java-driver) | 3.0+ |
|
||||
|
@ -228,11 +229,10 @@ Because the automatic instrumentation runs in a different classpath than the ins
|
|||
| [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 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+ |
|
||||
| [http4k <sup>†</sup>](https://www.http4k.org/guide/modules/opentelemetry/) | 3.270.0+ |
|
||||
| [http4k <sup>†</sup>](https://www.http4k.org/guide/modules/opentelemetry/) | 3.270.0+ |
|
||||
| [Hystrix](https://github.com/Netflix/Hystrix) | 1.4+ |
|
||||
| [JAX-RS](https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/package-summary.html) | 0.5+ |
|
||||
| [JAX-RS Client](https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/client/package-summary.html) | 2.0+ |
|
||||
|
@ -256,7 +256,7 @@ Because the automatic instrumentation runs in a different classpath than the ins
|
|||
| [RabbitMQ Client](https://github.com/rabbitmq/rabbitmq-java-client) | 2.7+ |
|
||||
| [Ratpack](https://github.com/ratpack/ratpack) | 1.4+ |
|
||||
| [Reactor](https://github.com/reactor/reactor-core) | 3.1+ |
|
||||
| [Reactor Netty](https://github.com/reactor/reactor-netty) | 0.9+ (not including 1.0) |
|
||||
| [Reactor Netty](https://github.com/reactor/reactor-netty) | 0.9+ (not including 1.0) |
|
||||
| [Rediscala](https://github.com/etaty/rediscala) | 1.8+ |
|
||||
| [Redisson](https://github.com/redisson/redisson) | 3.0+ |
|
||||
| [RMI](https://docs.oracle.com/en/java/javase/11/docs/api/java.rmi/java/rmi/package-summary.html) | Java 7+ |
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
muzzle {
|
||||
pass {
|
||||
group = "com.ning"
|
||||
module = "async-http-client"
|
||||
versions = "[1.9.0,)"
|
||||
assertInverse = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
library group: 'com.ning', name: 'async-http-client', version: '1.9.0'
|
||||
}
|
|
@ -3,14 +3,14 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.grizzly.client;
|
||||
package io.opentelemetry.javaagent.instrumentation.asynchttpclient;
|
||||
|
||||
import com.ning.http.client.Request;
|
||||
import io.opentelemetry.context.propagation.TextMapPropagator;
|
||||
|
||||
public class GrizzlyInjectAdapter implements TextMapPropagator.Setter<Request> {
|
||||
public class AsyncHttpClientInjectAdapter implements TextMapPropagator.Setter<Request> {
|
||||
|
||||
public static final GrizzlyInjectAdapter SETTER = new GrizzlyInjectAdapter();
|
||||
public static final AsyncHttpClientInjectAdapter SETTER = new AsyncHttpClientInjectAdapter();
|
||||
|
||||
@Override
|
||||
public void set(Request carrier, String key, String value) {
|
|
@ -3,44 +3,38 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.grizzly.client;
|
||||
package io.opentelemetry.javaagent.instrumentation.asynchttpclient;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
import io.opentelemetry.javaagent.instrumentation.api.Pair;
|
||||
import io.opentelemetry.javaagent.tooling.InstrumentationModule;
|
||||
import io.opentelemetry.javaagent.tooling.TypeInstrumentation;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@AutoService(InstrumentationModule.class)
|
||||
public class GrizzlyClientInstrumentationModule extends InstrumentationModule {
|
||||
public GrizzlyClientInstrumentationModule() {
|
||||
super("grizzly-client", "grizzly-client-1.9", "ning");
|
||||
@AutoService(io.opentelemetry.javaagent.tooling.InstrumentationModule.class)
|
||||
public class AsyncHttpClientInstrumentationModule
|
||||
extends io.opentelemetry.javaagent.tooling.InstrumentationModule {
|
||||
public AsyncHttpClientInstrumentationModule() {
|
||||
super("async-http-client", "async-http-client-1.9");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] helperClassNames() {
|
||||
return new String[] {
|
||||
packageName + ".GrizzlyClientTracer", packageName + ".GrizzlyInjectAdapter"
|
||||
packageName + ".AsyncHttpClientTracer", packageName + ".AsyncHttpClientInjectAdapter"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TypeInstrumentation> typeInstrumentations() {
|
||||
return asList(
|
||||
new GrizzlyClientRequestInstrumentation(), new GrizzlyClientResponseInstrumentation());
|
||||
return asList(new RequestInstrumentation(), new ResponseInstrumentation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> contextStore() {
|
||||
return singletonMap("com.ning.http.client.AsyncHandler", Pair.class.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean defaultEnabled() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.grizzly.client;
|
||||
package io.opentelemetry.javaagent.instrumentation.asynchttpclient;
|
||||
|
||||
import com.ning.http.client.Request;
|
||||
import com.ning.http.client.Response;
|
||||
|
@ -12,11 +12,11 @@ import io.opentelemetry.instrumentation.api.tracer.HttpClientTracer;
|
|||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
public class GrizzlyClientTracer extends HttpClientTracer<Request, Request, Response> {
|
||||
public class AsyncHttpClientTracer extends HttpClientTracer<Request, Request, Response> {
|
||||
|
||||
private static final GrizzlyClientTracer TRACER = new GrizzlyClientTracer();
|
||||
private static final AsyncHttpClientTracer TRACER = new AsyncHttpClientTracer();
|
||||
|
||||
public static GrizzlyClientTracer tracer() {
|
||||
public static AsyncHttpClientTracer tracer() {
|
||||
return TRACER;
|
||||
}
|
||||
|
||||
|
@ -47,11 +47,11 @@ public class GrizzlyClientTracer extends HttpClientTracer<Request, Request, Resp
|
|||
|
||||
@Override
|
||||
protected Setter<Request> getSetter() {
|
||||
return GrizzlyInjectAdapter.SETTER;
|
||||
return AsyncHttpClientInjectAdapter.SETTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getInstrumentationName() {
|
||||
return "io.opentelemetry.javaagent.grizzly-client";
|
||||
return "io.opentelemetry.javaagent.async-http-client";
|
||||
}
|
||||
}
|
|
@ -3,9 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.grizzly.client;
|
||||
|
||||
import static io.opentelemetry.javaagent.instrumentation.grizzly.client.GrizzlyClientTracer.tracer;
|
||||
package io.opentelemetry.javaagent.instrumentation.asynchttpclient;
|
||||
|
||||
import com.ning.http.client.AsyncHandler;
|
||||
import com.ning.http.client.Request;
|
||||
|
@ -17,17 +15,17 @@ import io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge;
|
|||
import io.opentelemetry.javaagent.instrumentation.api.Pair;
|
||||
import net.bytebuddy.asm.Advice;
|
||||
|
||||
public class GrizzlyClientRequestAdvice {
|
||||
public class RequestAdvice {
|
||||
|
||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||
public static Scope onEnter(
|
||||
@Advice.Argument(0) Request request, @Advice.Argument(1) AsyncHandler<?> handler) {
|
||||
Context parentContext = Java8BytecodeBridge.currentContext();
|
||||
|
||||
Span span = tracer().startSpan(request);
|
||||
Span span = AsyncHttpClientTracer.tracer().startSpan(request);
|
||||
InstrumentationContext.get(AsyncHandler.class, Pair.class)
|
||||
.put(handler, Pair.of(parentContext, span));
|
||||
return tracer().startScope(span, request);
|
||||
return AsyncHttpClientTracer.tracer().startScope(span, request);
|
||||
}
|
||||
|
||||
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
|
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.grizzly.client;
|
||||
package io.opentelemetry.javaagent.instrumentation.asynchttpclient;
|
||||
|
||||
import static java.util.Collections.singletonMap;
|
||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||
|
@ -16,7 +16,7 @@ import net.bytebuddy.description.method.MethodDescription;
|
|||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
final class GrizzlyClientRequestInstrumentation implements TypeInstrumentation {
|
||||
final class RequestInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<? super TypeDescription> typeMatcher() {
|
||||
|
@ -30,6 +30,6 @@ final class GrizzlyClientRequestInstrumentation implements TypeInstrumentation {
|
|||
.and(takesArgument(0, named("com.ning.http.client.Request")))
|
||||
.and(takesArgument(1, named("com.ning.http.client.AsyncHandler")))
|
||||
.and(isPublic()),
|
||||
GrizzlyClientRequestAdvice.class.getName());
|
||||
RequestAdvice.class.getName());
|
||||
}
|
||||
}
|
|
@ -3,9 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.grizzly.client;
|
||||
|
||||
import static io.opentelemetry.javaagent.instrumentation.grizzly.client.GrizzlyClientTracer.tracer;
|
||||
package io.opentelemetry.javaagent.instrumentation.asynchttpclient;
|
||||
|
||||
import com.ning.http.client.AsyncCompletionHandler;
|
||||
import com.ning.http.client.AsyncHandler;
|
||||
|
@ -18,7 +16,7 @@ import io.opentelemetry.javaagent.instrumentation.api.InstrumentationContext;
|
|||
import io.opentelemetry.javaagent.instrumentation.api.Pair;
|
||||
import net.bytebuddy.asm.Advice;
|
||||
|
||||
public class GrizzlyClientResponseAdvice {
|
||||
public class ResponseAdvice {
|
||||
|
||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||
public static Scope onEnter(
|
||||
|
@ -33,7 +31,7 @@ public class GrizzlyClientResponseAdvice {
|
|||
contextStore.put(handler, null);
|
||||
}
|
||||
if (spanWithParent.hasRight()) {
|
||||
tracer().end(spanWithParent.getRight(), response);
|
||||
AsyncHttpClientTracer.tracer().end(spanWithParent.getRight(), response);
|
||||
}
|
||||
return spanWithParent.hasLeft() ? spanWithParent.getLeft().makeCurrent() : null;
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.javaagent.instrumentation.grizzly.client;
|
||||
package io.opentelemetry.javaagent.instrumentation.asynchttpclient;
|
||||
|
||||
import static io.opentelemetry.javaagent.tooling.ClassLoaderMatcher.hasClassesNamed;
|
||||
import static java.util.Collections.singletonMap;
|
||||
|
@ -18,7 +18,7 @@ import net.bytebuddy.description.method.MethodDescription;
|
|||
import net.bytebuddy.description.type.TypeDescription;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
final class GrizzlyClientResponseInstrumentation implements TypeInstrumentation {
|
||||
final class ResponseInstrumentation implements TypeInstrumentation {
|
||||
|
||||
@Override
|
||||
public ElementMatcher<ClassLoader> classLoaderMatcher() {
|
||||
|
@ -36,6 +36,6 @@ final class GrizzlyClientResponseInstrumentation implements TypeInstrumentation
|
|||
named("onCompleted")
|
||||
.and(takesArgument(0, named("com.ning.http.client.Response")))
|
||||
.and(isPublic()),
|
||||
GrizzlyClientResponseAdvice.class.getName());
|
||||
ResponseAdvice.class.getName());
|
||||
}
|
||||
}
|
|
@ -13,11 +13,7 @@ import io.opentelemetry.instrumentation.test.base.HttpClientTest
|
|||
import spock.lang.AutoCleanup
|
||||
import spock.lang.Shared
|
||||
|
||||
class GrizzlyAsyncHttpClientTest extends HttpClientTest {
|
||||
|
||||
static {
|
||||
System.setProperty("otel.instrumentation.grizzly-client.enabled", "true")
|
||||
}
|
||||
class AsyncHttpClientTest extends HttpClientTest {
|
||||
|
||||
@AutoCleanup
|
||||
@Shared
|
|
@ -1,24 +0,0 @@
|
|||
apply from: "$rootDir/gradle/instrumentation.gradle"
|
||||
|
||||
muzzle {
|
||||
pass {
|
||||
group = "org.glassfish.grizzly"
|
||||
module = "grizzly-http-client"
|
||||
versions = "[1.9,1.16]"
|
||||
assertInverse = true
|
||||
}
|
||||
pass {
|
||||
group = "com.ning"
|
||||
module = "async-http-client"
|
||||
versions = "[1.9.0,)"
|
||||
assertInverse = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
library group: 'org.glassfish.grizzly', name: 'grizzly-http-client', version: '1.9'
|
||||
// for some reason, the tests don't *load* until 1.12, but muzzles works as far back as 1.9
|
||||
testLibrary group: 'org.glassfish.grizzly', name: 'grizzly-http-client', version: '1.12'
|
||||
|
||||
latestDepTestLibrary group: 'org.glassfish.grizzly', name: 'grizzly-http-client', version: '1.16'
|
||||
}
|
|
@ -62,6 +62,7 @@ include ':instrumentation:apache-httpclient:apache-httpclient-4.0'
|
|||
include ':instrumentation:armeria-1.0:javaagent'
|
||||
include ':instrumentation:armeria-1.0:library'
|
||||
include ':instrumentation:armeria-1.0:testing'
|
||||
include ':instrumentation:async-http-client-1.9'
|
||||
include ':instrumentation:aws-lambda-1.0:javaagent'
|
||||
include ':instrumentation:aws-lambda-1.0:library'
|
||||
include ':instrumentation:aws-lambda-1.0:testing'
|
||||
|
@ -89,7 +90,6 @@ include ':instrumentation:finatra-2.9'
|
|||
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:grpc-1.5:javaagent'
|
||||
include ':instrumentation:grpc-1.5:library'
|
||||
include ':instrumentation:grpc-1.5:testing'
|
||||
|
|
Loading…
Reference in New Issue