You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by cr...@apache.org on 2022/04/06 02:59:48 UTC

[dubbo] branch 3.0 updated: fix #9877 (#9890)

This is an automated email from the ASF dual-hosted git repository.

crazyhzm pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new df5b0af7c7 fix #9877 (#9890)
df5b0af7c7 is described below

commit df5b0af7c76c84983671adf4b63a6a8faadcb926
Author: saleson <ql...@163.com>
AuthorDate: Wed Apr 6 10:59:18 2022 +0800

    fix #9877 (#9890)
---
 .../org/apache/dubbo/rpc/filter/ExecuteLimitFilter.java | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExecuteLimitFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExecuteLimitFilter.java
index c7efb40029..da36479724 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExecuteLimitFilter.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ExecuteLimitFilter.java
@@ -25,6 +25,9 @@ import org.apache.dubbo.rpc.Invoker;
 import org.apache.dubbo.rpc.Result;
 import org.apache.dubbo.rpc.RpcException;
 import org.apache.dubbo.rpc.RpcStatus;
+import org.apache.dubbo.rpc.service.GenericService;
+import static org.apache.dubbo.common.constants.CommonConstants.$INVOKE;
+import static org.apache.dubbo.common.constants.CommonConstants.$INVOKE_ASYNC;
 
 import static org.apache.dubbo.rpc.Constants.EXECUTES_KEY;
 
@@ -65,7 +68,7 @@ public class ExecuteLimitFilter implements Filter, Filter.Listener {
 
     @Override
     public void onResponse(Result appResponse, Invoker<?> invoker, Invocation invocation) {
-        RpcStatus.endCount(invoker.getUrl(), invocation.getMethodName(), getElapsed(invocation), true);
+        RpcStatus.endCount(invoker.getUrl(), getRealMethodName(invoker, invocation), getElapsed(invocation), true);
     }
 
     @Override
@@ -76,7 +79,17 @@ public class ExecuteLimitFilter implements Filter, Filter.Listener {
                 return;
             }
         }
-        RpcStatus.endCount(invoker.getUrl(), invocation.getMethodName(), getElapsed(invocation), false);
+        RpcStatus.endCount(invoker.getUrl(), getRealMethodName(invoker, invocation), getElapsed(invocation), false);
+    }
+
+    private String getRealMethodName(Invoker<?> invoker, Invocation invocation) {
+        if ((invocation.getMethodName().equals($INVOKE) || invocation.getMethodName().equals($INVOKE_ASYNC))
+            && invocation.getArguments() != null
+            && invocation.getArguments().length == 3
+            && !GenericService.class.isAssignableFrom(invoker.getInterface())) {
+            return ((String) invocation.getArguments()[0]).trim();
+        }
+        return invocation.getMethodName();
     }
 
     private long getElapsed(Invocation invocation) {