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

   <!-- Base branch: `rocketmq-studio`, the RocketMQ Studio trunk. -->
   
   ### Brief Description
   
   `ApacheRocketMqBusinessMetricsCollector` and 
`CloudRocketMqBusinessMetricsCollector` emitted
   every per-group `UNAVAILABLE` lag sample with a **null cluster scope**, 
while the available
   samples for the same group carry `group.getClusterId()`:
   
   ```java
   // before - ApacheRocketMqBusinessMetricsCollector.unavailable(...)
   return new MetricSample(metric, AlertDomain.BUSINESS, instance.getName(), 
null, labels, null,
           MetricAvailability.UNAVAILABLE, collectedAt, reason);
   ```
   
   That scope is not cosmetic. `NativeAlertRuleScopeMatcher.matches` matches a 
rule's cluster name
   against the sample's `clusterId`, and 
`NativeAlertProcessor.reconcileMissingActiveStates` treats a
   sample that does not appear in the successful collection as a series that 
disappeared - it then
   advances the state with a clear result and emits a `RESOLVED` event. So when 
a consumer group's
   consume stats or queue progress could not be read, a cluster-scoped lag rule 
silently resolved
   the group's active alert, even though nothing was known about its lag. 
`MetricSnapshotRepository`
   lookups are affected the same way: the window query filters on the sample's 
cluster scope.
   
   The per-group unavailable samples (stats unavailable, unknown lag sentinel, 
queue-progress read
   failure) now carry `group.getClusterId()`. The whole-scope failure marker 
keeps its empty labels
   and stays scope-less - that marker is the design that marks a collection 
knowing nothing about
   any group.
   
   ### How Did You Test This Change?
   
   Both new cases run against the unmodified trunk first (red), then against 
the fix (green).
   
   ```
   # on the unmodified base (new tests copied in, production code untouched)
   $ cd server && mvn -B -ntp test 
-Dtest=ApacheRocketMqBusinessMetricsCollectorTest,CloudRocketMqBusinessMetricsCollectorTest
   [ERROR] Tests run: 8, Failures: 2, Errors: 0, Skipped: 0 -- in 
...ApacheRocketMqBusinessMetricsCollectorTest
   [ERROR]   
ApacheRocketMqBusinessMetricsCollectorTest.keepsTheGroupClusterScopeOnUnavailableLagSamplesTest
   [ERROR]   
ApacheRocketMqBusinessMetricsCollectorTest.keepsTheGroupClusterScopeWhenQueueProgressFailsTest
   [ERROR] Tests run: 3, Failures: 1, Errors: 0, Skipped: 0 -- in 
...CloudRocketMqBusinessMetricsCollectorTest
   [ERROR]   
CloudRocketMqBusinessMetricsCollectorTest.keepsTheGroupClusterScopeWhenConsumerProgressFailsTest
   expected: "cluster-a"
    but was: null
   ```
   
   ```
   # with the fix
   $ cd server && mvn -B -ntp test 
-Dtest=ApacheRocketMqBusinessMetricsCollectorTest,CloudRocketMqBusinessMetricsCollectorTest,ApacheRocketMqClusterMetricsCollectorTest,ApacheRocketMqProxyMetricsCollectorTest,ApacheRocketMqDlqMetricsCollectorTest,CloudRocketMqClusterMetricsCollectorTest,CollectorSchedulerTest
   [INFO] --- checkstyle:3.6.0:check (validate) @ rocketmq-studio ---
   [INFO] You have 0 Checkstyle violations.
   [INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0 -- in 
...ApacheRocketMqBusinessMetricsCollectorTest
   [INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0 -- in 
...CloudRocketMqBusinessMetricsCollectorTest
   [INFO] Tests run: 35, Failures: 0, Errors: 0, Skipped: 0
   [INFO] BUILD SUCCESS
   ```
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`feat:` / `fix:` / 
`refactor:` / `chore:` / `docs:` / `perf:`)
   - [x] Tests added or updated for non-trivial changes, test methods named 
`...Test`
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/`
   - [x] Architecture constraints stay green (`mvn test` runs the ArchUnit 
checks)
   - [x] New source files carry the ASF license header
   - [x] Documentation touched where behaviour changed (README / `docs/` / 
in-app help)
   


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