89799969 opened a new pull request, #5068: URL: https://github.com/apache/rocketmq-dashboard/pull/5068
### Which Issue(s) This PR Fixes - Fixes #4510 ### Brief Description Tencent RocketMQ 5.x documents `SubscriptionData.ConsumerLag` as nullable when no valid value can be obtained. Studio converted that state to `0` in both `TencentInstanceProvider.getGroupProgress` and `TencentInstanceProvider.toTopicConsumer`, so an unavailable measurement was presented as a healthy zero backlog. The console already treats `-1` as the unknown-lag sentinel (`ConsumerLagResolver.UNKNOWN` / `web/src/utils/consumerLag.ts`), while a real `0` is a healthy zero. The second layer is `CloudRocketMqBusinessMetricsCollector`: it applied `Math.max(0, diffTotal)`, so even after a provider reported the unknown sentinel the cloud metric path clamped it back to zero and published an AVAILABLE sample. This change preserves the existing unknown-lag contract end to end: - `TencentInstanceProvider.getGroupProgress`: null lag becomes `-1` instead of `0`. - Tencent Topic-consumer mapping keeps `diffTotal=-1` and sets `metricsAvailable=false`, so the existing UI renders unavailable rather than `0`/`-1` as a quantity. - `CloudRocketMqBusinessMetricsCollector` no longer clamps negative unknown lag to zero. - If any progress row is unknown, group `consumer.lag.total` and `consumer.lag.max_queue` are UNAVAILABLE (`CONSUMER_LAG_UNKNOWN`). - Topic backlog remains granular: known topics keep valid samples, while a topic containing an unknown row is UNAVAILABLE. Known positive/zero lag semantics are unchanged. ### How Did You Test This Change? ``` $ cd server && mvn -B -ntp test -Dtest='TencentInstanceProviderTest,CloudRocketMqBusinessMetricsCollectorTest' [INFO] You have 0 Checkstyle violations. [INFO] Tests run: 58, Failures: 0, Errors: 0, Skipped: 0 [INFO] BUILD SUCCESS $ cd server && mvn -B -ntp test -Dtest='TencentInstanceProviderTest,CloudRocketMqBusinessMetricsCollectorTest,ApacheRocketMqBusinessMetricsCollectorTest,NativeAlertProcessorTest' [INFO] You have 0 Checkstyle violations. [INFO] Tests run: 88, Failures: 0, Errors: 0, Skipped: 0 [INFO] BUILD SUCCESS $ git diff --check (no output) ``` New regression tests: - `TencentInstanceProviderTest.getGroupProgressShouldMapMissingConsumerLagToUnknownTest` �� null lag maps to `-1`. - `TencentInstanceProviderTest.getGroupProgressShouldPreserveGenuineZeroConsumerLagTest` �� real `0` stays `0`. - `TencentInstanceProviderTest.getTopicConsumersShouldMarkMissingConsumerLagUnavailableTest` �� known zero stays available; null lag is `-1` and `metricsAvailable=false`. - `CloudRocketMqBusinessMetricsCollectorTest.reportsUnavailableGroupLagWhenAnyProgressRowIsUnknownTest` �� mixed known/unknown progress makes group total/max UNAVAILABLE instead of clamping to `0`. - `CloudRocketMqBusinessMetricsCollectorTest.keepsKnownTopicBacklogAndMarksUnknownTopicUnavailableTest` �� known topic keeps its sample, unknown topic is UNAVAILABLE. - `CloudRocketMqBusinessMetricsCollectorTest.preservesGenuineZeroLagAsAvailableZeroTest` �� real zero lag stays an AVAILABLE `0`. ### Provider contract Tencent's current `SubscriptionData` documentation states that `ConsumerLag` may return null when a valid value cannot be obtained: https://cloud.tencent.com/document/product/1493/96031 AI-assisted source audit, implementation and regression authoring; all commands above were executed locally against `master@0228dad5`. ### Scoring (AGENTS.md) | Item | Score | |---|---:| | ���� Issue `Fixes #4510` | 3.1�C6.3 | | �ļ��ģ�����Դ�룺provider + collector�� | 2.5�C3.8 | | �ļ����ͣ�Դ��/���ԣ� | 1.3�C3.1 | | �������� / �������� / �ļ����� | 0�C2.3 each | | **Ԥ���ܷ�** | **~8�C12** | ### Checklist - [x] One coherent change; unrelated modifications are not bundled in - [x] Commit subject follows Conventional Commits (`fix:`) - [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/` (none added; backend only) - [x] Architecture constraints stay green (`mvn test` runs the ArchUnit checks) - focused suites green; full ArchUnit not run here - [x] New source files carry the ASF license header (no new files) - [x] Documentation touched where behaviour changed (README / `docs/` / in-app help) - none needed -- 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]
