songxiaosheng commented on code in PR #12389:
URL: https://github.com/apache/dubbo/pull/12389#discussion_r1206248371


##########
dubbo-metrics/dubbo-metrics-default/src/main/java/org/apache/dubbo/metrics/filter/MetricsFilter.java:
##########
@@ -40,20 +41,24 @@
 public class MetricsFilter implements Filter, BaseFilter.Listener, 
ScopeModelAware {
 
     private ApplicationModel applicationModel;
-    private final static ErrorTypeAwareLogger LOGGER = 
LoggerFactory.getErrorTypeAwareLogger(MetricsFilter.class);
+    private static final ErrorTypeAwareLogger LOGGER = 
LoggerFactory.getErrorTypeAwareLogger(MetricsFilter.class);
+    private boolean metricsEnable;
 
     @Override
     public void setApplicationModel(ApplicationModel applicationModel) {
         this.applicationModel = applicationModel;
+        this.metricsEnable = 
applicationModel.getApplicationConfigManager().getMetrics().map(MetricsConfig::getEnabled).orElse(true);
     }
 
     @Override
     public Result invoke(Invoker<?> invoker, Invocation invocation) throws 
RpcException {
-        try {
-            RequestEvent requestEvent = 
RequestEvent.toRequestEvent(applicationModel, invocation);
-            MetricsEventBus.before(requestEvent, () -> 
invocation.put(METRIC_FILTER_EVENT, requestEvent));
-        } catch (Throwable t) {
-            LOGGER.warn(INTERNAL_ERROR, "", "", "Error occurred when invoke.", 
t);
+        if (metricsEnable) {

Review Comment:
   这个开关要不要改下名字,这个只是配置RPC的开关,我们指标还有三大中心、线程池、应用等指标信息,这个开关可以只控制RPC的指标采集,可以把名字改下见名知意



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to