btlqql opened a new pull request, #4294:
URL: https://github.com/apache/rocketmq-dashboard/pull/4294
## What is the purpose of the change
Fixes #4293.
`RocketMQMetadataProvider.getTopicConsumersPage` keeps the internal lag
sentinel (`-1`) in
`diffTotal` when a queue's lag cannot be determined, but never clears
`TopicConsumerVO.metricsAvailable` (which `@Builder.Default`s to `true`).
The topic page keys the
unavailable rendering off that flag, so an undeterminable lag was shown to
the operator as a backlog
of `-1` while the sibling failure branch in the same method reported
`metricsAvailable=false`.
## Brief changelog
-
`server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQMetadataProvider.java`
- `getTopicConsumersPage` now records that a queue resolved to
`ConsumerLagResolver.UNKNOWN` and
builds the row with `metricsAvailable(!lagUnknown)`, matching the
neighbouring "stats could not be
read" branch.
- `diffTotal` keeps carrying the sentinel for callers that read it
directly, and known-lag sums are
unchanged.
-
`server/src/test/java/org/apache/rocketmq/studio/provider/apache/RocketMQMetadataProviderTest.java`
- New `getTopicConsumersMarksMetricsUnavailableWhenAnyQueueLagIsUnknown`.
## Verification
Red, before the fix (`mvn -o -f server/pom.xml test
-Dtest=RocketMQMetadataProviderTest`):
```
[ERROR] Tests run: 41, Failures: 1, Errors: 0, Skipped: 0, Time elapsed:
5.330 s <<< FAILURE! -- in
org.apache.rocketmq.studio.provider.apache.RocketMQMetadataProviderTest
Expecting value to be false but was true
[ERROR]
RocketMQMetadataProviderTest.getTopicConsumersMarksMetricsUnavailableWhenAnyQueueLagIsUnknown:517
[ERROR] Tests run: 41, Failures: 1, Errors: 0, Skipped: 0
[INFO] BUILD FAILURE
```
Green, after the fix (`mvn -o -f server/pom.xml test
-Dtest=RocketMQMetadataProviderTest`):
```
[INFO] Tests run: 41, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
3.723 s -- in
org.apache.rocketmq.studio.provider.apache.RocketMQMetadataProviderTest
[INFO] Tests run: 41, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS
```
The pre-existing `getTopicConsumersKeepsUnknownWhenAnyQueueLagIsUnknown`
(which asserts
`diffTotal == ConsumerLagResolver.UNKNOWN`) and
`getTopicConsumersStillSumsKnownQueueLags` both still
pass, so known-lag sums are unaffected.
## AI disclosure
Drafted with AI assistance (analysis, patch and test authoring); the red and
green Maven output above
was executed and observed locally on Windows, JDK 21.
--
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]