RockteMQ-AI commented on code in PR #4512:
URL:
https://github.com/apache/rocketmq-dashboard/pull/4512#discussion_r4035802144
##########
server/src/main/java/org/apache/rocketmq/studio/cluster/metrics/collectors/CloudRocketMqBusinessMetricsCollector.java:
##########
@@ -87,19 +87,30 @@ private static List<MetricSample>
collectGroup(InstanceProvider provider, Instan
Map<String, String> labels = Map.of("consumerGroup", group.getName());
try {
List<QueueProgressVO> progress =
provider.getGroupProgress(instance.getName(), group.getName());
- double totalLag = progress.stream().mapToDouble(row ->
Math.max(0L, row.getDiffTotal())).sum();
- double maxQueueLag = progress.stream().mapToDouble(row ->
Math.max(0L, row.getDiffTotal())).max()
- .orElse(0D);
+ boolean lagUnknown = progress.stream().anyMatch(row ->
row.getDiffTotal() < 0);
Review Comment:
The `lagUnknown` scan iterates the full `progress` list, and then the
subsequent `if/else` block iterates it again. Consider combining into a single
pass if this list can be large in production. Minor performance note — not a
blocker.
--
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]