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

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


The following commit(s) were added to refs/heads/3.2 by this push:
     new 302f57c7ee bug fix (#12088)
302f57c7ee is described below

commit 302f57c7ee368fbe6aed413f236797730744be5e
Author: wxbty <[email protected]>
AuthorDate: Fri Apr 14 10:09:49 2023 +0800

    bug fix (#12088)
    
    Co-authored-by: x-shadow-man <[email protected]>
---
 .../org/apache/dubbo/metrics/filter/MethodMetricsInterceptor.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/dubbo-metrics/dubbo-metrics-default/src/main/java/org/apache/dubbo/metrics/filter/MethodMetricsInterceptor.java
 
b/dubbo-metrics/dubbo-metrics-default/src/main/java/org/apache/dubbo/metrics/filter/MethodMetricsInterceptor.java
index b4767f3f77..7c61eda55f 100644
--- 
a/dubbo-metrics/dubbo-metrics-default/src/main/java/org/apache/dubbo/metrics/filter/MethodMetricsInterceptor.java
+++ 
b/dubbo-metrics/dubbo-metrics-default/src/main/java/org/apache/dubbo/metrics/filter/MethodMetricsInterceptor.java
@@ -64,11 +64,11 @@ public class MethodMetricsInterceptor {
             return;
         }
         String side = getSide(invocation);
+
+        MetricsEvent.Type eventType = MetricsEvent.Type.UNKNOWN_FAILED;
         if (throwable instanceof RpcException) {
             RpcException e = (RpcException) throwable;
 
-            MetricsEvent.Type eventType = MetricsEvent.Type.UNKNOWN_FAILED;
-
             if (e.isTimeout()) {
                 eventType = MetricsEvent.Type.REQUEST_TIMEOUT;
             }
@@ -84,8 +84,8 @@ public class MethodMetricsInterceptor {
             if (e.isNetwork()) {
                 eventType = MetricsEvent.Type.NETWORK_EXCEPTION;
             }
-            sampler.incOnEvent(invocation, eventType.getNameByType(side));
         }
+        sampler.incOnEvent(invocation, eventType.getNameByType(side));
         onCompleted(invocation);
         sampler.incOnEvent(invocation, 
MetricsEvent.Type.TOTAL_FAILED.getNameByType(side));
     }

Reply via email to