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

   <!-- Base branch: `rocketmq-studio`, the RocketMQ Studio trunk. -->
   
   ### Brief Description
   
   `ApacheRocketMqBusinessMetricsCollector` skipped the 
`consumer.delay.seconds` sample entirely
   when the broker reported consume stats without a consumed-message timestamp:
   
   ```java
   if (group.isConsumptionTimestampAvailable()) {
       samples.add(delaySample(instance, group, collectedAt));
   }
   // no else: the delay metric simply disappears for that group
   ```
   
   The same collector already treats that state as unavailable everywhere else 
- the
   `!group.isConsumeStatsAvailable()` branch right above emits 
`CONSUMER_DELAY_SECONDS` as
   `UNAVAILABLE` with `CONSUMER_STATS_UNAVAILABLE`, and an unknown lag sentinel 
is reported as
   unavailable rather than as a fabricated zero.
   
   The omission is the consequential representation: `CONSUMER_DELAY_SECONDS` 
is part of the
   collector's declared metric scope, and 
`NativeAlertProcessor.reconcileMissingActiveStates`
   walks the active states of that scope and resolves every fingerprint that no 
collected sample
   covers. A group whose broker stops reporting the consumed-message timestamp 
therefore had its
   active `consumer.delay.seconds` alert resolved - including a resolution 
notification - even
   though its delay was merely unknown.
   
   The collector now emits the delay as `UNAVAILABLE` with the reason
   `CONSUMER_TIMESTAMP_UNAVAILABLE`, keeping the group's cluster scope like the 
other per-group
   samples.
   
   ### How Did You Test This Change?
   
   The new case runs against the unmodified trunk first (red), then against the 
fix (green).
   
   ```
   # on the unmodified base (new test copied in, production code untouched)
   $ cd server && mvn -B -ntp test 
-Dtest=ApacheRocketMqBusinessMetricsCollectorTest
   [ERROR] Tests run: 7, Failures: 1, Errors: 0, Skipped: 0 -- in 
...ApacheRocketMqBusinessMetricsCollectorTest
   [ERROR]   
ApacheRocketMqBusinessMetricsCollectorTest.reportsUnavailableDelayWhenTheConsumptionTimestampIsMissingTest:168
   Expected size: 1 but was: 0 in:
   ```
   
   ```
   # with the fix
   $ cd server && mvn -B -ntp test 
-Dtest=ApacheRocketMqBusinessMetricsCollectorTest,CloudRocketMqBusinessMetricsCollectorTest,CollectorSchedulerTest
   [INFO] --- checkstyle:3.6.0:check (validate) @ rocketmq-studio ---
   [INFO] You have 0 Checkstyle violations.
   [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0 -- in 
...ApacheRocketMqBusinessMetricsCollectorTest
   [INFO] Tests run: 21, Failures: 0, Errors: 0, Skipped: 0
   [INFO] BUILD SUCCESS
   ```
   
   The open PR #4517 changes the neighbouring availability handling of the same 
collector
   (`consumer.lag.max_queue`, `topic.backlog.total` for unknown queue progress) 
but explicitly
   leaves the delay semantics unchanged; this change is the delay counterpart 
and touches only the
   `isConsumptionTimestampAvailable()` branch plus its own helper.
   
   ### 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