-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Description
Pre-check
- I am sure that all the content I provide is in English.
Search before asking
- I had searched in the issues and found no similar issues.
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
- Start the application.
- Run
curl -s http://127.0.0.1:18180/metrics | grep '^dubbo_' | sort— no output is returned. - Change
dubbo.metrics.protocolinapplication.propertiestodefault. - Run
curl -s http://127.0.0.1:18180/metrics | grep '^dubbo_' | sort— all metrics are displayed normally. - Restore
dubbo.metrics.protocoltoprometheus, comment the dependencydubbo-observability-spring-boot-starter, uncomment the dependencydubbo-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.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.PrometheusMetricsReporter cannot proceed either.
Do you have a (mini) reproduction demo?
- Yes, I have a minimal reproduction demo to help resolve this issue more effectively!
Are you willing to submit a pull request to fix on your own?
- Yes I am willing to submit a pull request on my own!
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Type
Projects
Status