Fix testIndy on main (#11582)
This commit is contained in:
parent
55e723e810
commit
9f11c4a36a
|
@ -26,6 +26,12 @@ public class FinagleHttpInstrumentationModule extends InstrumentationModule {
|
|||
new H2StreamChannelInitInstrumentation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIndyModule() {
|
||||
// injects helpers to access package-private members
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHelperClass(String className) {
|
||||
return className.equals("com.twitter.finagle.ChannelTransportHelpers")
|
||||
|
|
|
@ -10,13 +10,17 @@ import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.
|
|||
import com.google.auto.service.AutoService;
|
||||
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
|
||||
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
|
||||
import io.opentelemetry.javaagent.extension.instrumentation.internal.ExperimentalInstrumentationModule;
|
||||
import io.opentelemetry.javaagent.extension.instrumentation.internal.injection.ClassInjector;
|
||||
import io.opentelemetry.javaagent.extension.instrumentation.internal.injection.InjectionMode;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.bytebuddy.matcher.ElementMatcher;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@AutoService(InstrumentationModule.class)
|
||||
public class GraphqlInstrumentationModule extends InstrumentationModule {
|
||||
public class GraphqlInstrumentationModule extends InstrumentationModule
|
||||
implements ExperimentalInstrumentationModule {
|
||||
|
||||
public GraphqlInstrumentationModule() {
|
||||
super("graphql-java", "graphql-java-20.0");
|
||||
|
@ -32,4 +36,14 @@ public class GraphqlInstrumentationModule extends InstrumentationModule {
|
|||
public List<TypeInstrumentation> typeInstrumentations() {
|
||||
return Collections.singletonList(new GraphqlInstrumentation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectClasses(ClassInjector injector) {
|
||||
// we do not use ByteBuddy Advice dispatching in this instrumentation
|
||||
// Instead, we manually call GraphqlSingletons via ASM
|
||||
// Easiest solution to work with indy is to inject an indy-proxy to be invoked
|
||||
injector
|
||||
.proxyBuilder("io.opentelemetry.javaagent.instrumentation.graphql.v20_0.GraphqlSingletons")
|
||||
.inject(InjectionMode.CLASS_ONLY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,4 +23,10 @@ public class InfluxDbInstrumentationModule extends InstrumentationModule {
|
|||
public List<TypeInstrumentation> typeInstrumentations() {
|
||||
return singletonList(new InfluxDbImplInstrumentation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIndyModule() {
|
||||
// Uses multiple Advice.Locals and argument assignment
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,4 +31,10 @@ public class ContextPropagationOperator34InstrumentationModule extends Instrumen
|
|||
public List<TypeInstrumentation> typeInstrumentations() {
|
||||
return singletonList(new ContextPropagationOperator34Instrumentation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIndyModule() {
|
||||
// Requires Otel-API bride
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue