You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Roronoa-Zoro (via GitHub)" <gi...@apache.org> on 2026/02/13 16:06:03 UTC
[D] dubbo-samples-metrics-spring-boot 示例升级到springboot 3.3就不展示dubbo到指标了 [dubbo]
GitHub user Roronoa-Zoro created a discussion: dubbo-samples-metrics-spring-boot 示例升级到springboot 3.3就不展示dubbo到指标了
### Pre-check
- [X] I am sure that all the content I provide is in English.
### Apache Dubbo Component
Java SDK (apache/dubbo)
### Details
dubbo-samples-metrics-spring-boot 把这个示例项目的springboot 升级到3.3,jdk21,指标就不展示了,请问这是什么情况?
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
GitHub link: https://github.com/apache/dubbo/discussions/16084
----
This is an automatically sent email for notifications@dubbo.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@dubbo.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [D] dubbo-samples-metrics-spring-boot 示例升级到springboot 3.3就不展示dubbo到指标了 [dubbo]
Posted by "younghwan91 (via GitHub) via notifications" <no...@dubbo.apache.org>.
GitHub user younghwan91 added a comment to the discussion: dubbo-samples-metrics-spring-boot 示例升级到springboot 3.3就不展示dubbo到指标了
原因是 Spring Boot 3.3 带的 Micrometer 1.13 换了 Prometheus 客户端:`micrometer-registry-prometheus` 的包名从 `io.micrometer.prometheus` 改成了 `io.micrometer.prometheusmetrics`,底层也从 `simpleclient` 换成了 Prometheus client 1.x。
Dubbo 3.3.6 及之前判断能不能启用 Prometheus reporter,只看旧包里的类([MetricsSupportUtil](https://github.com/apache/dubbo/blob/f1585880bee4ca7776f44380c47c994217721ffe/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/utils/MetricsSupportUtil.java#L26-L31)):
```java
return isClassPresent("io.micrometer.prometheus.PrometheusConfig")
&& isClassPresent("io.prometheus.client.exporter.BasicAuthHttpConnectionFactory")
&& ...
```
升级到 Boot 3.3 以后 classpath 上没有 `io.micrometer.prometheus.PrometheusConfig` 了,Dubbo 就静默跳过 Prometheus reporter,所以 `/prometheus` 里看不到 `dubbo_*` 指标。同样的问题见 #16109。
解决办法:
1. 推荐:升级到 **Dubbo 3.3.7**。#16132 已经合入 3.3.7,新旧两套 Prometheus 栈都能识别,同时存在时优先用新的。如果 Boot 3.3/3.4 下两套 registry 同时生效,指标又看不到了,再加上:
```properties
dubbo.metrics.use-global-registry=true
```
或者只保留 `micrometer-registry-prometheus-simpleclient` / `micrometer-registry-prometheus` 其中一个。
2. 暂时不能升级 Dubbo 的话:加上旧栈依赖,让旧的类回到 classpath(版本由 Boot BOM 管理,这个方案我没有实际跑过):
```xml
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus-simpleclient</artifactId>
</dependency>
```
另外,Boot 3 把 `management.metrics.export.prometheus.enabled` 改名成了 `management.prometheus.metrics.export.enabled`,示例里的 `application.yaml` 也要跟着改。
如果这个回答解决了你的问题,麻烦标记为 Answer,方便遇到同样问题的人找到。
GitHub link: https://github.com/apache/dubbo/discussions/16084#discussioncomment-19903516
----
This is an automatically sent email for notifications@dubbo.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@dubbo.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org