This is an automated email from the ASF dual-hosted git repository.
earthchen 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 4903cab551 abnormal time count (#11710)
4903cab551 is described below
commit 4903cab55149145078543975d2a04a335438b77a
Author: FanYang <[email protected]>
AuthorDate: Sat Mar 4 20:30:37 2023 +0800
abnormal time count (#11710)
---
.../org/apache/dubbo/metrics/filter/MethodMetricsInterceptor.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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 a66c42139d..2394fbe56a 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
@@ -76,16 +76,22 @@ public class MethodMetricsInterceptor {
if (throwable instanceof RpcException && ((RpcException)
throwable).isBiz()) {
onCompleted(invocation);
+ }else{
+ rtTime(invocation);
}
sampler.incOnEvent(invocation,MetricsEvent.Type.TOTAL_FAILED);
}
- private void onCompleted(Invocation invocation) {
+ private void rtTime(Invocation invocation){
Long endTime = System.currentTimeMillis();
Long beginTime = (Long) invocation.get(METRIC_FILTER_START_TIME);
Long rt = endTime - beginTime;
sampler.addRT(invocation, rt);
+ }
+
+ private void onCompleted(Invocation invocation) {
+ rtTime(invocation);
sampler.dec(invocation,MetricsEvent.Type.PROCESSING);
}
}