iloveeyjafjalla opened a new issue, #6852:
URL: https://github.com/apache/rocketmq-dashboard/issues/6852

   ### Studio Version
   
   branch: `rocketmq-studio` @ `a92c2314`
   
   ### Runtime Environment
   
   The repository's own stack: backend on 8888 against its MySQL, the console 
on the dev server, one Apache instance (`local-broker`) pointing at a 
NameServer that serves a broker on 127.0.0.1:10912. This is not a cluster 
problem - the console reports its own numbers here.
   
   ### Connected RocketMQ Cluster
   
   RocketMQ 5.5.0 broker, direct to NameServer (V4_DIRECT).
   
   ### Describe the Bug
   
   `GET /api/clusters` answers `topicCount: 0` and `groupCount: 0` for every 
cluster, and so does `GET /api/clusters/{id}`:
   
   ```json
   {"id": "DefaultCluster", ..., "status": "healthy", "version": null, 
"topicCount": 0, "groupCount": 0}
   ```
   
   No cluster path measures those numbers:
   
   * `provider/apache/RocketMQClusterProvider.buildClusterVO` hardcodes 
`.topicCount(0).groupCount(0)`;
   * `cluster/broker/RealClusterProvider.toClusterVO` never sets them, so they 
stay at the `int` default;
   * `ClusterRepositoryImpl` only copies them through (`defensiveCopy`), and 
the only non-zero values in the tree are the demo fixtures it builds itself 
(128/45, 32/12).
   
   The cluster really holds 32 topics and 1 consumer group, and the console 
already serves those measured numbers for the same cluster name from its 
overview:
   
   ```
   GET /api/clusters?instanceId=local-broker          -> 
{"name":"DefaultCluster","topicCount":0,"groupCount":0}
   GET /api/clusters/DefaultCluster?instanceId=...    -> 
{"name":"DefaultCluster","topicCount":0,"groupCount":0}
   GET /api/dashboard?instanceId=local-broker         -> 
{"name":"DefaultCluster","topics":32,"groups":1}
   ```
   
   Because both fields are primitives (`private int topicCount;`), a client 
cannot tell "this cluster has no topics" from "this endpoint never measured 
them": `docs/api-spec.md` documents them as plain `Topic 数量` / `消费组数量` with no 
availability marker, and `web/src/api/cluster.ts` declares them `number`.
   
   ### Steps to Reproduce
   
   1. Start the stack and point an instance at a NameServer that holds topics 
and consumer groups.
   2. `curl 'http://127.0.0.1:8888/api/clusters?instanceId=local-broker'` -> 
`"topicCount": 0`, `"groupCount": 0`.
   3. `curl 
'http://127.0.0.1:8888/api/clusters/DefaultCluster?instanceId=local-broker'` -> 
the same zeros.
   4. `curl 'http://127.0.0.1:8888/api/dashboard?instanceId=local-broker'` -> 
`"topics": 32`, `"groups": 1` for the same cluster.
   
   ### What Did You Expect to See?
   
   Either a measured count, or no claim at all. The console reads neither field 
(`grep -rn "topicCount\|groupCount" web/src/pages/cluster 
web/src/services/clusterService.ts` is empty now that the copy in 
`clusterService.ts` is the only carrier), and the measured per-cluster numbers 
already arrive with `GET /api/dashboard`, so the two fields are a duplicate 
that can go - the same call #6101 makes for the topic statistics no provider 
computes.
   
   ### What Did You See Instead?
   
   Two counts that are documented as real numbers, serialized as `0` on every 
cluster, for every instance, on both the list and the detail endpoint.
   
   ### Additional Context
   
   Counting them on this path is not free: per-cluster counts need 
`getAllTopicConfig` + `getAllSubscriptionGroup` per master broker, which is the 
walk `RocketMQDashboardProvider` performs for the overview. So if the list 
should carry them, that walk has to be shared deliberately instead of a 
constant being set.
   
   `web/src/i18n/translations.ts` keeps a `cluster.topicCount` label that no 
component reads; left alone here as it is dead either way.
   


-- 
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