barry3406 opened a new pull request, #16205:
URL: https://github.com/apache/dubbo/pull/16205

   ## What is the purpose of the change?
   
   Fixes #16109. `MetricsSupportUtil.isSupportPrometheus()` currently only 
looks for `io.micrometer.prometheus.PrometheusConfig`, which was renamed to 
`io.micrometer.prometheusmetrics.PrometheusConfig` in Micrometer 1.13 (Spring 
Boot 3.3+), and also hard-requires the legacy `io.prometheus.client.exporter.*` 
classes that are no longer pulled in by 
`dubbo-observability-spring-boot-starter` in Dubbo 3.3.x. The net effect is 
that Prometheus reporter initialization is silently skipped for recent Spring 
Boot users, exactly matching the reproducer in the issue.
   
   This change updates the check to accept either the legacy 
`io.micrometer.prometheus` package or the new `io.micrometer.prometheusmetrics` 
package, and drops the legacy `io.prometheus.client.*` requirements. Those are 
only needed in Pushgateway mode, and `PrometheusMetricsReporterFactory` already 
handles their absence via `NoClassDefFoundError`, so the extra `isClassPresent` 
hop here was just producing false negatives for scrape-only deployments.
   
   Per @RainYuY's note on the issue that a compatible path is what's needed, 
this keeps the fix minimal and strictly scoped to the detection util so older 
Spring Boot 3.2.x / Micrometer < 1.13 users keep working.
   
   ## Checklist
   - [x] Make sure there is a 
[GitHub_issue](https://github.com/apache/dubbo/issues) field for the change. 
(Fixes #16109)
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Write necessary unit-test to verify your logic correction. 
`MetricsSupportUtilTest` covers the four classpath layouts (legacy only, new 
only, both, neither) by stubbing `ClassUtils` with `mockito-inline`, so 
detection is exercised regardless of which Micrometer Prometheus registry 
happens to be on the test runtime classpath.
   - [x] Make sure gitHub actions can pass. Locally ran `mvn -pl 
dubbo-metrics/dubbo-metrics-api -am -Psources,skip-spotless,checkstyle clean 
install -Dmaven.test.skip=true`, `mvn -pl dubbo-metrics/dubbo-metrics-api 
-Pjacoco,skip-spotless test verify`, `mvn -pl 
dubbo-metrics/dubbo-metrics-prometheus -Pjacoco,skip-spotless test verify`, 
plus `mvn -pl dubbo-config/dubbo-config-api 
-Dtest=DefaultApplicationDeployerTest test` and `mvn spotless:check` on JDK 21 
— all green.


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

Reply via email to