SavitarC commented on PR #16110: URL: https://github.com/apache/dubbo/pull/16110#issuecomment-3976931156
`org.apache.dubbo.metrics.prometheus.PrometheusMetricsReporter` is still using `io.prometheus.client.exporter.PushGateway`, `io.micrometer.prometheus.PrometheusConfig`, and some other deprecated classes. Perhaps we still need to fix this class? I’m concerned that an error may occur when creating the metrics reporter in `org.apache.dubbo.config.deploy.DefaultApplicationDeployer#initMetricsReporter`. <img width="2064" height="397" alt="image" src="https://github.com/user-attachments/assets/cf594390-fd4f-421e-9736-3537c83c031b" /> ```java try { metricsReporter = metricsReporterFactory.createMetricsReporter(metricsConfig.toUrl()); } catch (IllegalStateException e) { if (e.getMessage().startsWith("No such extension org.apache.dubbo.metrics.report.MetricsReporterFactory")) { logger.warn(COMMON_METRICS_COLLECTOR_EXCEPTION, "", "", e.getMessage()); return; } else { throw e; } } ``` ```java public class PrometheusMetricsReporterFactory extends AbstractMetricsReporterFactory { private final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(PrometheusMetricsReporterFactory.class); public PrometheusMetricsReporterFactory(ApplicationModel applicationModel) { super(applicationModel); } @Override public MetricsReporter createMetricsReporter(URL url) { try { return new PrometheusMetricsReporter(url, getApplicationModel()); } catch (NoClassDefFoundError ncde) { String msg = ncde.getMessage(); if (dependenciesNotFound(msg)) { logger.error( INTERNAL_ERROR, "", "", "Failed to load class \"org.apache.dubbo.metrics.prometheus.PrometheusMetricsReporter\".", ncde); logger.error( INTERNAL_ERROR, "", "", "Defaulting to no-operation (NOP) metricsReporter implementation", ncde); logger.error( INTERNAL_ERROR, "", "", "Introduce the micrometer-core package to use the ability of metrics", ncde); return new NopPrometheusMetricsReporter(); } else { logger.error(INTERNAL_ERROR, "", "", "Failed to instantiate PrometheusMetricsReporter", ncde); throw ncde; } } } private static boolean dependenciesNotFound(String msg) { if (msg == null) { return false; } if (msg.contains("io/micrometer/core/instrument/composite/CompositeMeterRegistry")) { return true; } return msg.contains("io.micrometer.core.instrument.composite.CompositeMeterRegistry"); } } ``` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
