Pre-check
Search before asking
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
Dubbo 3.3.6
JDK 21
Spring Boot 3.5.10
Steps to reproduce this issue
demo
- Start the application.
- Run
curl -s http://127.0.0.1:18180/metrics | grep '^dubbo_' | sort — no output is returned.
- Change
dubbo.metrics.protocol in application.properties to default.
- Run
curl -s http://127.0.0.1:18180/metrics | grep '^dubbo_' | sort — all metrics are displayed normally.
- Restore
dubbo.metrics.protocol to prometheus, comment the dependency dubbo-observability-spring-boot-starter, uncomment the dependency dubbo-spring-boot-observability-starter, and redeploy the application.
- Run
curl -s http://127.0.0.1:18180/metrics | grep '^dubbo_' | sort — all metrics are displayed normally.
What you expected to happen
The class compatibility checks in MetricsSupportUtil should be updated to align with Spring Boot 3.3.x and the latest Prometheus client dependencies.
The metrics reporter should initialize successfully without being blocked by outdated class path validations.
Anything else
In org.apache.dubbo.config.deploy.DefaultApplicationDeployer#initMetricsReporter, when the protocol is set to prometheus, it checks whether Prometheus is supported:
if (PROTOCOL_PROMETHEUS.equals(metricsConfig.getProtocol()) && !MetricsSupportUtil.isSupportPrometheus()) {
return;
}
The validation logic is as follows:
public class MetricsSupportUtil {
public static 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");
}
private static boolean isClassPresent(String className) {
return ClassUtils.isPresent(className, MetricsSupportUtil.class.getClassLoader());
}
}
There are several issues with this validation logic:
-
io.micrometer.prometheus.PrometheusConfig no longer exists from Spring Boot 3.3.x onwards; it has been replaced by io.micrometer.prometheusmetrics.PrometheusConfig.
-
The io.prometheus.client.* classes are not included when using the dubbo-observability-spring-boot-starter in Dubbo 3.3.x. The relevant dependencies are only included in the 3.2.x version of dubbo-spring-boot-observability-starter, and they belong to Prometheus Client 0.16.0, which is deprecated.
Either of these issues will cause the validation to fail, which skips the reporter initialization and results in no metrics being output. Consequently, the subsequent initialization of org.apache.dubbo.metrics.prometheus.PrometheusMetricsReporter cannot proceed either.
Do you have a (mini) reproduction demo?
Are you willing to submit a pull request to fix on your own?
Code of Conduct
Pre-check
Search before asking
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
Dubbo 3.3.6
JDK 21
Spring Boot 3.5.10
Steps to reproduce this issue
demo
curl -s http://127.0.0.1:18180/metrics | grep '^dubbo_' | sort— no output is returned.dubbo.metrics.protocolinapplication.propertiestodefault.curl -s http://127.0.0.1:18180/metrics | grep '^dubbo_' | sort— all metrics are displayed normally.dubbo.metrics.protocoltoprometheus, comment the dependencydubbo-observability-spring-boot-starter, uncomment the dependencydubbo-spring-boot-observability-starter, and redeploy the application.curl -s http://127.0.0.1:18180/metrics | grep '^dubbo_' | sort— all metrics are displayed normally.What you expected to happen
The class compatibility checks in
MetricsSupportUtilshould be updated to align with Spring Boot 3.3.x and the latest Prometheus client dependencies.The metrics reporter should initialize successfully without being blocked by outdated class path validations.
Anything else
In
org.apache.dubbo.config.deploy.DefaultApplicationDeployer#initMetricsReporter, when the protocol is set to prometheus, it checks whether Prometheus is supported:The validation logic is as follows:
There are several issues with this validation logic:
io.micrometer.prometheus.PrometheusConfigno longer exists from Spring Boot 3.3.x onwards; it has been replaced byio.micrometer.prometheusmetrics.PrometheusConfig.The
io.prometheus.client.*classes are not included when using thedubbo-observability-spring-boot-starterin Dubbo 3.3.x. The relevant dependencies are only included in the 3.2.x version ofdubbo-spring-boot-observability-starter, and they belong to Prometheus Client 0.16.0, which is deprecated.Either of these issues will cause the validation to fail, which skips the reporter initialization and results in no metrics being output. Consequently, the subsequent initialization of
org.apache.dubbo.metrics.prometheus.PrometheusMetricsReportercannot proceed either.Do you have a (mini) reproduction demo?
Are you willing to submit a pull request to fix on your own?
Code of Conduct