This is an automated email from the ASF dual-hosted git repository.
albumenj 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 20a713faf5 🐛 if it has exception processing request need end too.
(#11881)
20a713faf5 is described below
commit 20a713faf5d093ce2ecd2ed0d562fc0213b6ec32
Author: songxiaosheng <[email protected]>
AuthorDate: Tue Mar 28 15:57:21 2023 +0800
🐛 if it has exception processing request need end too. (#11881)
---
.../dubbo/config/deploy/DefaultApplicationDeployer.java | 12 +++++-------
.../dubbo/metrics/filter/MethodMetricsInterceptor.java | 10 ++--------
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
index c933e43b42..46dbf18ddc 100644
---
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
+++
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java
@@ -370,12 +370,10 @@ public class DefaultApplicationDeployer extends
AbstractDeployer<ApplicationMode
collector.setCollectEnabled(true);
collector.collectApplication(applicationModel);
String protocol = metricsConfig.getProtocol();
- if (StringUtils.isNotEmpty(protocol)) {
- MetricsReporterFactory metricsReporterFactory =
getExtensionLoader(MetricsReporterFactory.class).getAdaptiveExtension();
- MetricsReporter metricsReporter =
metricsReporterFactory.createMetricsReporter(metricsConfig.toUrl());
- metricsReporter.init();
-
applicationModel.getBeanFactory().registerBean(metricsReporter);
- }
+ MetricsReporterFactory metricsReporterFactory =
getExtensionLoader(MetricsReporterFactory.class).getAdaptiveExtension();
+ MetricsReporter metricsReporter =
metricsReporterFactory.createMetricsReporter(metricsConfig.toUrl());
+ metricsReporter.init();
+ applicationModel.getBeanFactory().registerBean(metricsReporter);
}
}
@@ -1121,7 +1119,7 @@ public class DefaultApplicationDeployer extends
AbstractDeployer<ApplicationMode
}
}
- private void startMetricsCollector(){
+ private void startMetricsCollector() {
DefaultMetricsCollector collector =
applicationModel.getBeanFactory().getBean(DefaultMetricsCollector.class);
collector.registryDefaultSample();
}
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 74fd349f7b..b4767f3f77 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
@@ -86,17 +86,11 @@ public class MethodMetricsInterceptor {
}
sampler.incOnEvent(invocation, eventType.getNameByType(side));
}
-
- if (throwable instanceof RpcException && ((RpcException)
throwable).isBiz()) {
- onCompleted(invocation);
- }else{
- rtTime(invocation);
- }
-
+ onCompleted(invocation);
sampler.incOnEvent(invocation,
MetricsEvent.Type.TOTAL_FAILED.getNameByType(side));
}
- private void rtTime(Invocation invocation){
+ private void rtTime(Invocation invocation) {
Long endTime = System.currentTimeMillis();
Long beginTime = (Long) invocation.get(METRIC_FILTER_START_TIME);
Long rt = endTime - beginTime;