tju-yxq opened a new issue, #1394: URL: https://github.com/apache/rocketmq-dashboard/issues/1394
## Bug Report ### Before Creating the Bug Report - [x] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq/discussions). - [x] I have searched the [GitHub Issues](https://github.com/apache/rocketmq/issues) and [GitHub Discussions](https://github.com/apache/rocketmq/discussions) of this repository and believe that this is not a duplicate. - [x] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ. ### Runtime platform environment OS: Ubuntu 20.04 / Any OS running RocketMQ Studio ### RocketMQ version branch: rocketmq-studio version: 5.3.2+ Git commit id: f727341 ### JDK Version OpenJDK 21 ### Describe the Bug `RocketMQDashboardProvider.collectDashboardData()` computes the **global** total topic count and total consumer group count correctly, but each per-cluster `ClusterOverviewVO` is always built with `topics(0)` and `groups(0)`. This means the dashboard's top-level stats show the correct totals, but every individual cluster card in the UI displays "0 topics" and "0 groups", even when the cluster actually has topics and groups. ```java // Per-cluster overview is built with hardcoded zeros: clusters.add(ClusterOverviewVO.builder() .id(clusterName) .name(clusterName) .type(clusterType) .status(runtimeMetricsUnavailable ? ClusterStatus.warning : ClusterStatus.healthy) .brokers(clusterBrokers) .proxies(0) .topics(0) // ← BUG: always zero .groups(0) // ← BUG: always zero .tpsIn(clusterTpsIn) .tpsOut(clusterTpsOut) .version(version) .throughput(List.of()) .build()); ``` The global counts (`totalTopics`, `totalGroups`) are computed earlier by fetching all topics and all subscription groups from all brokers. But the per-cluster breakdown is never populated - the code iterates clusters and brokers, accumulates TPS per cluster, but never counts how many topics or groups belong to each specific cluster. ### Steps to Reproduce 1. Start a RocketMQ cluster with at least one topic and one consumer group. 2. Open RocketMQ Studio dashboard. 3. Observe the top-level stats: total topics and total consumer groups show correct values. 4. Look at the cluster card(s) in the dashboard: each cluster shows "0 topics" and "0 groups". ### What Did You Expect to See? Each cluster card should display the actual number of topics and consumer groups belonging to that cluster. ### What Did You See Instead? Every cluster card shows 0 topics and 0 groups. ### Additional Context **Affected file**: `server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQDashboardProvider.java`, method `collectDashboardData()` at approximately line 195. **Root cause**: The method fetches `TopicList` and `SubscriptionGroupWrapper` globally but never partitions them by cluster. The per-cluster loop accumulates TPS and broker count, but skips topic/group counting entirely. **Fix approach**: The fix requires partitioning topics and groups by cluster. RocketMQ's `ClusterInfo` maps cluster names to broker names. Topics can be associated with clusters via their route data (`admin.examineTopicRouteInfo(topic)`), but that would be too expensive for a dashboard overview (one admin call per topic). A more practical approach: 1. Build a `brokerName -> clusterName` map from `ClusterInfo.getClusterAddrTable()`. 2. For each broker, the `SubscriptionGroupWrapper` already gives us the groups on that broker - associate them with the cluster that broker belongs to. 3. For topics, use `admin.fetchTopicsByCluster(clusterName)` if available, or partition the global `TopicList` by checking each topic's route data against the broker-to-cluster map. As a simpler alternative, count topics per cluster from the `QueueData` in `examineTopicRouteInfo` - but for a dashboard overview, an approximate count based on the existing `fetchAllTopicList` + route lookup is acceptable. 4. Set the computed counts on each `ClusterOverviewVO`. This fix adds approximately 30-40 lines (broker-to-cluster map + per-cluster topic/group counting) without removing any existing logic. -- 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]
