Use to capture method name instead of method
MODIFY
instrumentation/vaadin-14.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vaadin/RpcInvocationHandlerInstrumentation.java
instrumentation/vaadin-14.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vaadin/RpcInvocationHandlerInstrumentation.java
@@ -18,7 +18,6 @@ import io.opentelemetry.context.Scope;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
import io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge;
-import java.lang.reflect.Method;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
@@ -52,14 +51,14 @@ public class RpcInvocationHandlerInstrumentation implements TypeInstrumentation
@Advice.OnMethodEnter(suppress = Throwable.class)
public static void onEnter(
@Advice.This RpcInvocationHandler rpcInvocationHandler,
- @Advice.Origin Method method,
+ @Advice.Origin("#m") String methodName,
@Advice.Argument(1) JsonObject jsonObject,
@Advice.Local("otelRequest") VaadinRpcRequest request,
@Advice.Local("otelContext") Context context,
@Advice.Local("otelScope") Scope scope) {
Context parentContext = Java8BytecodeBridge.currentContext();
- request = VaadinRpcRequest.create(rpcInvocationHandler, method, jsonObject);
+ request = VaadinRpcRequest.create(rpcInvocationHandler, methodName, jsonObject);
if (!rpcInstrumenter().shouldStart(parentContext, request)) {
return;
}

MODIFY
instrumentation/vaadin-14.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vaadin/VaadinRpcRequest.java
instrumentation/vaadin-14.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vaadin/VaadinRpcRequest.java
@@ -8,19 +8,18 @@ package io.opentelemetry.javaagent.instrumentation.vaadin;
import com.google.auto.value.AutoValue;
import com.vaadin.flow.server.communication.rpc.RpcInvocationHandler;
import elemental.json.JsonObject;
-import java.lang.reflect.Method;
@AutoValue
public abstract class VaadinRpcRequest {
public static VaadinRpcRequest create(
- RpcInvocationHandler rpcInvocationHandler, Method method, JsonObject jsonObject) {
- return new AutoValue_VaadinRpcRequest(rpcInvocationHandler, method, jsonObject);
+ RpcInvocationHandler rpcInvocationHandler, String methodName, JsonObject jsonObject) {
+ return new AutoValue_VaadinRpcRequest(rpcInvocationHandler, methodName, jsonObject);
}
abstract RpcInvocationHandler getRpcInvocationHandler();
- abstract Method getMethod();
+ abstract String getMethodName();
abstract JsonObject getJsonObject();
}

MODIFY
instrumentation/vaadin-14.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vaadin/VaadinSingletons.java
instrumentation/vaadin-14.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vaadin/VaadinSingletons.java
@@ -83,7 +83,8 @@ public class VaadinSingletons {
private static String rpcSpanName(VaadinRpcRequest rpcRequest) {
RpcInvocationHandler rpcInvocationHandler = rpcRequest.getRpcInvocationHandler();
- String spanName = SpanNames.fromMethod(rpcInvocationHandler.getClass(), rpcRequest.getMethod());
+ String spanName =
+ SpanNames.fromMethod(rpcInvocationHandler.getClass(), rpcRequest.getMethodName());
if ("event".equals(rpcInvocationHandler.getRpcType())) {
String eventType = rpcRequest.getJsonObject().getString("event");
if (eventType != null) {

Use @Advice.Origin to capture method name instead of method (#4609)