Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.asm.Advice.AssignReturned;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;

Expand All @@ -34,9 +35,10 @@ public void transform(TypeTransformer transformer) {

@SuppressWarnings("unused")
public static class AddInstrumentationAdvice {
@AssignReturned.ToReturned
@Advice.OnMethodExit(suppress = Throwable.class)
public static void onExit(@Advice.Return(readOnly = false) Instrumentation instrumentation) {
instrumentation = addInstrumentation(instrumentation);
public static Instrumentation onExit(@Advice.Return Instrumentation instrumentation) {
return addInstrumentation(instrumentation);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
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 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-12.0");
Expand All @@ -34,4 +36,9 @@ public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
public List<TypeInstrumentation> typeInstrumentations() {
return Collections.singletonList(new GraphqlInstrumentation());
}

@Override
public boolean isIndyReady() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.asm.Advice.AssignReturned;
import net.bytebuddy.asm.AsmVisitorWrapper;
import net.bytebuddy.description.field.FieldDescription;
import net.bytebuddy.description.field.FieldList;
Expand Down Expand Up @@ -106,10 +107,11 @@ public void visitFieldInsn(

@SuppressWarnings("unused")
public static class AddInstrumentationAdvice {
@AssignReturned.ToReturned
@Advice.OnMethodExit(suppress = Throwable.class)
public static void onExit(@Advice.Return(readOnly = false) Instrumentation instrumentation) {
public static Instrumentation onExit(@Advice.Return Instrumentation instrumentation) {
// this advice is here only to get GraphqlSingletons injected and checked by muzzle
instrumentation = addInstrumentation(instrumentation);
return addInstrumentation(instrumentation);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ public void injectClasses(ClassInjector injector) {
.proxyBuilder("io.opentelemetry.javaagent.instrumentation.graphql.v20_0.GraphqlSingletons")
.inject(InjectionMode.CLASS_ONLY);
}

@Override
public boolean isIndyReady() {
return true;
}
}