Skip to content

Commit 2a0e0b9

Browse files
committed
feedback
1 parent 9c6269b commit 2a0e0b9

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6

instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6/GrpcTelemetry.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
1515
import io.opentelemetry.instrumentation.grpc.v1_6.internal.Internal;
1616
import java.lang.reflect.Method;
17+
import java.lang.reflect.Proxy;
1718
import java.util.logging.Level;
1819
import java.util.logging.Logger;
1920
import javax.annotation.Nullable;
@@ -95,12 +96,15 @@ public void addClientInterceptor(ManagedChannelBuilder<?> builder) {
9596
if (interceptWithTargetMethod != null && interceptorFactoryClass != null) {
9697
try {
9798
Object factory =
98-
java.lang.reflect.Proxy.newProxyInstance(
99+
Proxy.newProxyInstance(
99100
ManagedChannelBuilder.class.getClassLoader(),
100101
new Class<?>[] {interceptorFactoryClass},
101102
(proxy, method, args) -> {
102-
String target = (String) args[0];
103-
return newTracingClientInterceptor(target);
103+
if ("newInterceptor".equals(method.getName())) {
104+
String target = (String) args[0];
105+
return newTracingClientInterceptor(target);
106+
}
107+
return null;
104108
});
105109
interceptWithTargetMethod.invoke(null, builder, factory);
106110
return;

0 commit comments

Comments
 (0)