Skip to content

Commit

Permalink
fix bug: get return type in a wrong way for method instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
darcyda1 committed May 29, 2022
1 parent efd40f8 commit 6ff3d4d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.opentelemetry.instrumentation.api.util.ClassAndMethod;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import java.lang.reflect.Method;
import java.util.Set;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
Expand Down Expand Up @@ -72,7 +73,7 @@ public static void onEnter(

@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
public static void stopSpan(
@Advice.Origin("#r") Class<?> returnType,
@Advice.Origin Method method,
@Advice.Local("otelMethod") ClassAndMethod classAndMethod,
@Advice.Local("otelContext") Context context,
@Advice.Local("otelScope") Scope scope,
Expand All @@ -81,7 +82,7 @@ public static void stopSpan(
scope.close();

returnValue =
AsyncOperationEndSupport.create(instrumenter(), Void.class, returnType)
AsyncOperationEndSupport.create(instrumenter(), Void.class, method.getReturnType())
.asyncEnd(context, classAndMethod, returnValue, throwable);
}
}
Expand Down

0 comments on commit 6ff3d4d

Please sign in to comment.