You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "AlbumenJ (via GitHub)" <gi...@apache.org> on 2023/05/23 13:01:50 UTC

[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #12389: add metrics enable switch

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


##########
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(false);

Review Comment:
   ```suggestion
           this.metricsEnable = applicationModel.getApplicationConfigManager().getMetrics().map(MetricsConfig::getEnabled).orElse(true);
   ```
   
   Enabling metrics by default can provide users with a better experience.
   BTW, if micrometer cannot found, Dubbo will disable metrics.



-- 
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-unsubscribe@dubbo.apache.org

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


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