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

[GitHub] [dubbo] conghuhu commented on a diff in pull request #12453: refactor: migrate tracing core from boot-start to dubbo deployer

conghuhu commented on code in PR #12453:
URL: https://github.com/apache/dubbo/pull/12453#discussion_r1227979338


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java:
##########
@@ -409,26 +415,35 @@ private void initMetricsReporter() {
         }
     }
 
-    public boolean isSupportMetrics() {
-        return isClassPresent("io.micrometer.core.instrument.MeterRegistry");
-    }
-
-    public static boolean isSupportPrometheus() {
-        return isClassPresent("io.micrometer.prometheus.PrometheusConfig")
-            && isClassPresent("io.prometheus.client.exporter.BasicAuthHttpConnectionFactory")
-            && isClassPresent("io.prometheus.client.exporter.HttpConnectionFactory")
-            && isClassPresent("io.prometheus.client.exporter.PushGateway");
-    }
-
+    /**
+     * init ObservationRegistry(Micrometer)
+     */
+    private void initObservationRegistry() {
+        if (!ObservationSupportUtil.isSupportObservation()) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Not found micrometer-observation or plz check the version of micrometer-observation version if already introduced, need > 1.10.0");
+            }
+            return;
+        }
+        if (!ObservationSupportUtil.isSupportTracing()) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Not found micrometer-tracing dependency, skip init ObservationRegistry.");
+            }
+            return;
+        }
+        Optional<TracingConfig> configOptional = configManager.getTracing();
+        if (!configOptional.isPresent() || !configOptional.get().getEnabled()) {
+            return;
+        }
 
-    private static boolean isClassPresent(String className) {
-        return ClassUtils.isPresent(className, DefaultApplicationDeployer.class.getClassLoader());
+        DubboObservationRegistry dubboObservationRegistry = new DubboObservationRegistry(applicationModel, configOptional.get());

Review Comment:
   Yes, due to the Observation.class was proposed after version 1.10 of micrometer, when users use springroot2.x, it defaults to 1.9.x, which means Observation.class is missing. We have made the corresponding judgment and provided users with debug level log prompts.
   
   As for Option<TracingConfig>, this is the switch that determines whether Dubbo itself has enabled the Tracing function



-- 
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