You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "utafrali (via GitHub)" <gi...@apache.org> on 2026/03/10 20:41:01 UTC

[PR] fix(metrics): support new micrometer prometheus package and make pushgateway optional [dubbo]

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

   Fixes #16109
   
   Ran into this while setting up Dubbo 3.3.6 with Spring Boot 3.5 and `dubbo-observability-spring-boot-starter`. Prometheus metrics were silently not initializing because `MetricsSupportUtil.isSupportPrometheus()` was checking for class names that no longer exist in Micrometer 1.13+ (`io.micrometer.prometheus.PrometheusConfig`) and requiring PushGateway exporter classes that aren't always on the classpath.
   
   The detection now accepts both the old `io.micrometer.prometheus` and the new `io.micrometer.prometheusmetrics` package. PushGateway classes are no longer required for the check since most setups just use the scrape endpoint.
   
   Also wrapped PushGateway initialization in `PrometheusMetricsReporter` with a `NoClassDefFoundError` catch so the reporter still works for scrape mode when pushgateway deps are missing. Broadened the error handling in `PrometheusMetricsReporterFactory.dependenciesNotFound()` to properly catch any micrometer or prometheus class loading failures.
   
   Tests:
   
   ```
   mvn -pl dubbo-metrics/dubbo-metrics-api -Dtest=MetricsSupportUtilTest test
   mvn -pl dubbo-metrics/dubbo-metrics-prometheus -Dtest=PrometheusMetricsReporterTest,PrometheusMetricsReporterFactoryTest test
   mvn -pl dubbo-config/dubbo-config-api -am -Dtest=DefaultApplicationDeployerTest test
   ```
   
   All passing locally on JDK 21.


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix(metrics): support new micrometer prometheus package and make pushgateway optional [dubbo]

Posted by "utafrali (via GitHub)" <gi...@apache.org>.
utafrali commented on PR #16128:
URL: https://github.com/apache/dubbo/pull/16128#issuecomment-4249987087

   Thanks for the pointer to #16132 — the adapter approach there is more thorough than what I have here.
   
   Just to clarify the scope of this PR in case it's useful: it doesn't drop PushGateway support. It only stops requiring the PushGateway classes inside `MetricsSupportUtil.isSupportPrometheus()` and wraps the initializer in a `NoClassDefFoundError` catch, so scrape-only setups stop silently failing when PushGateway isn't on the classpath. When the PushGateway deps are present it still initializes the exporter normally.
   
   That said, #16132 covers proper dual-stack detection and both legacy/new PushGateway paths, which supersedes this. If that one lands I'm happy to close this out; leaving it open for now only in case a smaller interim patch is useful.


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix(metrics): support new micrometer prometheus package and make pushgateway optional [dubbo]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #16128:
URL: https://github.com/apache/dubbo/pull/16128#issuecomment-4035175902

   ## [Codecov](https://app.codecov.io/gh/apache/dubbo/pull/16128?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `9.09091%` with `20 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 32.17%. Comparing base ([`bd2ed2a`](https://app.codecov.io/gh/apache/dubbo/commit/bd2ed2ae8ccbc577e6fab61169be2cf422c8e010?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`96a0722`](https://app.codecov.io/gh/apache/dubbo/commit/96a072200c9ab484c566b385ee8be51f8e65ce08?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/dubbo/pull/16128?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [.../metrics/prometheus/PrometheusMetricsReporter.java](https://app.codecov.io/gh/apache/dubbo/pull/16128?src=pr&el=tree&filepath=dubbo-metrics%2Fdubbo-metrics-prometheus%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdubbo%2Fmetrics%2Fprometheus%2FPrometheusMetricsReporter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZHViYm8tbWV0cmljcy9kdWJiby1tZXRyaWNzLXByb21ldGhldXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL21ldHJpY3MvcHJvbWV0aGV1cy9Qcm9tZXRoZXVzTWV0cmljc1JlcG9ydGVyLmphdmE=) | 0.00% | [15 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo/pull/16128?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...s/prometheus/PrometheusMetricsReporterFactory.java](https://app.codecov.io/gh/apache/dubbo/pull/16128?src=pr&el=tree&filepath=dubbo-metrics%2Fdubbo-metrics-prometheus%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdubbo%2Fmetrics%2Fprometheus%2FPrometheusMetricsReporterFactory.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZHViYm8tbWV0cmljcy9kdWJiby1tZXRyaWNzLXByb21ldGhldXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2R1YmJvL21ldHJpY3MvcHJvbWV0aGV1cy9Qcm9tZXRoZXVzTWV0cmljc1JlcG9ydGVyRmFjdG9yeS5qYXZh) | 0.00% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo/pull/16128?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...apache/dubbo/metrics/utils/MetricsSupportUtil.java](https://app.codecov.io/gh/apache/dubbo/pull/16128?src=pr&el=tree&filepath=dubbo-metrics%2Fdubbo-metrics-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdubbo%2Fmetrics%2Futils%2FMetricsSupportUtil.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZHViYm8tbWV0cmljcy9kdWJiby1tZXRyaWNzLWFwaS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZHViYm8vbWV0cmljcy91dGlscy9NZXRyaWNzU3VwcG9ydFV0aWwuamF2YQ==) | 66.66% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/dubbo/pull/16128?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   > :exclamation:  There is a different number of reports uploaded between BASE (bd2ed2a) and HEAD (96a0722). Click for more details.
   > 
   > <details><summary>HEAD has 7 uploads less than BASE</summary>
   >
   >| Flag | BASE (bd2ed2a) | HEAD (96a0722) |
   >|------|------|------|
   >|integration-tests-java21|1|0|
   >|integration-tests-java8|1|0|
   >|unit-tests-java8|1|0|
   >|unit-tests-java25|1|0|
   >|unit-tests-java11|1|0|
   >|unit-tests-java17|1|0|
   >|unit-tests-java21|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##                3.3   #16128       +/-   ##
   =============================================
   - Coverage     60.79%   32.17%   -28.62%     
   + Complexity    11754    10209     -1545     
   =============================================
     Files          1953     1952        -1     
     Lines         89118    89100       -18     
     Branches      13444    13359       -85     
   =============================================
   - Hits          54182    28671    -25511     
   - Misses        29368    56230    +26862     
   + Partials       5568     4199     -1369     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/dubbo/pull/16128/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [integration-tests-java21](https://app.codecov.io/gh/apache/dubbo/pull/16128/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/16128/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [samples-tests-java21](https://app.codecov.io/gh/apache/dubbo/pull/16128/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `32.13% <9.09%> (-0.02%)` | :arrow_down: |
   | [samples-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/16128/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `29.71% <9.09%> (-0.04%)` | :arrow_down: |
   | [unit-tests-java11](https://app.codecov.io/gh/apache/dubbo/pull/16128/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java17](https://app.codecov.io/gh/apache/dubbo/pull/16128/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java21](https://app.codecov.io/gh/apache/dubbo/pull/16128/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java25](https://app.codecov.io/gh/apache/dubbo/pull/16128/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/16128/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dubbo/pull/16128?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix(metrics): support new micrometer prometheus package and make pushgateway optional [dubbo]

Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw closed pull request #16128: fix(metrics): support new micrometer prometheus package and make pushgateway optional
URL: https://github.com/apache/dubbo/pull/16128


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix(metrics): support new micrometer prometheus package and make pushgateway optional [dubbo]

Posted by "SavitarC (via GitHub)" <gi...@apache.org>.
SavitarC commented on PR #16128:
URL: https://github.com/apache/dubbo/pull/16128#issuecomment-4060142412

   Thanks for the contribution. I’m not sure whether dropping support for the new PushGateway version directly would be the most appropriate approach. 
   @zrlw plz check my PR and see if it might be a suitable way forward? #16132 


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix(metrics): support new micrometer prometheus package and make pushgateway optional [dubbo]

Posted by "zrlw (via GitHub)" <gi...@apache.org>.
zrlw commented on PR #16128:
URL: https://github.com/apache/dubbo/pull/16128#issuecomment-4295006356

   solved by https://github.com/apache/dubbo/pull/16132


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org