zmuxuny opened a new pull request, #4521:
URL: https://github.com/apache/rocketmq-dashboard/pull/4521

   ### Which Issue(s) This PR Fixes
   
   - Fixes #4519
   
   ### Brief Description
   
   `ApacheRocketMqClusterMetricsCollector` treated a successful Broker runtime 
RPC as Broker availability, but silently omitted `broker.disk.usage_ratio`, 
`broker.jvm.heap.usage_ratio`, or `broker.send_queue.usage_ratio` when the 
corresponding runtime fields were missing or invalid.
   
   Native alert reconciliation uses metric-sample presence to distinguish a 
disappeared metric from a still-present unavailable metric. Omitting the sample 
could therefore make an active Broker alert look recovered and emit a false 
RESOLVED/recovery notification.
   
   This change makes each supported Broker runtime metric explicit: parsing 
success emits AVAILABLE; missing/invalid input emits a broker-scoped 
UNAVAILABLE sample with the same `brokerName`/`brokerAddr` fingerprint. Other 
Broker metrics remain independently usable.
   
   ### Red / Green Verification
   
   Baseline: `master@987b748e8f4f421c5cd3c4c4e51a064cc7e59f18`.
   
   Fail-before:
   - Added a Broker runtime fixture with a reachable Broker and an empty 
runtime table.
   - The regression requires broker-scoped UNAVAILABLE samples for disk, JVM 
heap, and send queue metrics.
   - `ApacheRocketMqClusterMetricsCollectorTest`: **4 tests, exactly 1 
failure** because the old collector emitted no sample.
   
   Green, Java 21:
   - `ApacheRocketMqClusterMetricsCollectorTest,NativeAlertProcessorTest`: 
**26/26 passed**.
   - Added a cross-module alert contract proving a broker-scoped UNAVAILABLE 
sample keeps an active fingerprint and emits no RESOLVED event/recovery outbox 
entry.
   - Checkstyle: **0 violations**.
   - `mvn -B -ntp -DskipTests package`: **BUILD SUCCESS**.
   - `git diff --check`: clean.
   
   ### Compatibility / Risk
   
   Valid numeric runtime values are unchanged. A Broker runtime RPC failure 
still produces the existing `broker.availability` UNAVAILABLE sample. This 
patch only replaces silent per-field omission with explicit per-Broker 
availability, matching the native alert state machine's existing UNAVAILABLE 
semantics.
   
   No API/schema/dependency/frontend changes.
   
   AI-assisted source audit, implementation and regression authoring; the 
missing-sample reconciliation path was reproduced before changing production 
code.
   


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