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

   ## What is this PR for?
   
   This PR adds compatibility for both the legacy and the new Prometheus client 
stacks in Dubbo metrics reporting, allowing users to run with either dependency 
set without changing Dubbo-side logic. By default, the new stack is preferred 
when both are present on the classpath.
   
   The reporter now detects a supported Prometheus stack at runtime and 
continues to support Pushgateway workflows, including basic authentication.
   
   ## What changes were made?
   
   - Added stack-detection utilities for:
     - the legacy `micrometer-registry-prometheus` / `simpleclient` stack
     - the new `micrometer-registry-prometheus` (`prometheusmetrics`) / new 
Pushgateway stack
   - Refactored `PrometheusMetricsReporter` to use an adapter abstraction:
     - `LegacyPrometheusClientAdapter`
     - `NewPrometheusClientAdapter`
   - Added runtime adapter selection based on classpath availability
   - Kept the existing Pushgateway scheduling flow, but routed push/create/auth 
operations through the selected adapter
   - Added support for the builder-style Pushgateway API used by the new stack
   - Updated dependencies, BOM configuration, and Spring Boot autoconfiguration 
wiring to include both the old and new Prometheus artifacts, including 
`prometheus-metrics-exporter-pushgateway`
   - Extended tests to cover Pushgateway behavior and authentication behavior 
on the new adapter path
   
   ## Why is this needed?
   
   Different deployments currently depend on different generations of 
Prometheus and Micrometer libraries. This change makes the Dubbo metrics 
reporter compatible with both stacks and reduces upgrade friction for users 
migrating between them.
   
   ## How to use it
   
   Use the following dependencies together:
   
   - `dubbo-spring-boot-starter`
   - `dubbo-metrics-prometheus`
   - `dubbo-observability-spring-boot-starter`
   - `spring-boot-starter-actuator`
   
   With this combination, the new Prometheus stack is preferred by default when 
both stacks are available.
   
   ## Additional Notes
   
   ### Spring Boot 3.3.x and 3.4.x registry conflict
   
   In Spring Boot 3.3.x and 3.4.x, both of the following auto-configurations 
may coexist:
   
   - `PrometheusSimpleclientMetricsExportAutoConfiguration`
   - `PrometheusMetricsExportAutoConfiguration`
   
   When both are active at the same time, registry conflicts may occur, causing 
Prometheus metrics to become invisible.
   
   ### Solutions
   
   There are two possible solutions:
   
   1. Manually exclude one of the two Prometheus registry implementations from 
`dubbo-metrics-prometheus`:
      - `micrometer-registry-prometheus-simpleclient`
      - `micrometer-registry-prometheus`
   
      Only one of them should remain.
   
   2. Enable the following configuration:
   
   ```properties
   dubbo.metrics.use-global-registry=true


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