imDwAaY opened a new pull request, #7966:
URL: https://github.com/apache/shenyu/pull/7966

   ## Problem
   
   Policy 3 (metric-driven scaling) never actuates. 
`MetricsMonitor.monitorMetrics()` evaluates enabled `ScaleRuleDO` rows and 
calls `notifyObservers(...)`, but nothing ever calls 
`MetricsMonitor.addObserver(...)` and `ScaleObserver` is never instantiated in 
production code. The observer list is therefore always empty: Prometheus is 
read and rules are evaluated, but `KubernetesScaler.scaleByAction` is never 
reached.
   
   Fixes #7965.
   
   ## Change
   
   - `ScaleObserver` is now a Spring `@Component`.
   - `MetricsMonitor` constructor-injects `List<Observer>` and copies it into 
its mutable observer list, so Spring registers every `Observer` bean at 
startup. The existing `addObserver` / `removeObserver` contract is unchanged.
   
   ## Tests
   
   New `MetricsMonitorTest` covers:
   
   - metric above `maximum` produces exactly one `SCALE_UP` action
   - metric below `minimum` produces exactly one `SCALE_DOWN` action
   - metric within bounds produces no action
   - a disabled rule fetches no metric and produces no action
   - an observer supplied through the constructor receives the update
   
   All 27 targeted tests pass and checkstyle reports 0 violations (Java 17).
   
   ## Relationship to #7913 / #7964
   
   This change only connects the actuator. Single-owner behavior in clustered 
Admin mode is handled by #7964 (#7913). Until that PR merges, metric-driven 
actuation would occur on every Admin replica, which is the pre-existing 
behavior of the scaling loop rather than something introduced here. Merging 
#7964 first (or together) gives the intended one-owner behavior.
   


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

Reply via email to