tju-yxq opened a new pull request, #2419:
URL: https://github.com/apache/rocketmq-dashboard/pull/2419
## Why
The Apache dashboard provider still hardcodes Proxy and NameServer topology
counts to `0`. Because both the backend response contract and the frontend
types model those values as non-null numbers, the home page renders "0 Proxy"
and a Proxy count of `0` even when Studio cannot discover the topology through
the selected access path.
This is different from "there are no Proxy nodes". A Proxy access endpoint
may be a load balancer and does not reveal the number of Proxy or NameServer
nodes behind it. The legacy no-instance path has the same problem when no
NameServer is configured.
This is based on the still-current issue #1947. The earlier #1948 was closed
as superseded by #1953, and #1953 was later superseded by #2307, but #2307 did
not carry the nullable topology-count contract.
## Backend contract
`DashboardStatsVO.totalProxies`, `DashboardStatsVO.totalNameServers`, and
`ClusterOverviewVO.proxies` now use nullable `Integer`:
- `null` means unavailable through the selected access path;
- `0` is retained only when the architecture makes absence known.
Counting rules:
- selected `DIRECT` instances:
- NameServer count is derived from the configured endpoint list (`;`/`,`
separated, trimmed, deduplicated);
- Proxy count is a known `0`.
- selected Proxy instances:
- Proxy and NameServer topology remain `null`;
- no claim is made about nodes hidden behind a Proxy/load-balancer
endpoint.
- legacy no-instance path:
- NameServer count is derived from the configured `rocketmq.namesrvAddr`;
- Proxy topology remains `null`.
- when no endpoint is configured at all, topology counts remain `null`
rather than being converted into false zeroes.
The AI dashboard tool forwards the nullable values unchanged; clients can
distinguish unknown topology from a real zero.
## Frontend
`DashboardStats` and `ClusterOverview` now model the topology counts as
`number | null`. The home dashboard renders unavailable values as `N/A`,
including the summary detail and the per-cluster Proxy column.
## Size
Production/API/UI change, excluding tests:
- 40 additions
- 18 deletions
Complete PR, including tests:
- 136 additions
- 18 deletions
The small production footprint is intentional: this is a
contract-correctness fix, not filler. It is not part of the "100+ line" batch;
it is submitted because #1947 is an existing confirmed issue that remains open.
## Testing
Backend focused:
```text
mvn -Dtest=RocketMQDashboardProviderTest,DashboardControllerTest test
30 tests
0 failures
0 errors
BUILD SUCCESS
Checkstyle: 0 violations
```
Backend full suite:
```text
mvn -DskipTests=false test
1,471 tests
0 failures
0 errors
BUILD SUCCESS
```
Frontend focused:
```text
npm test -- src/pages/home/__tests__/DashboardPage.test.tsx
src/api/metrics.test.ts
2 files
14 tests
all passed
```
Frontend full verification:
```text
npm test
all passed
npm run build
success
npm run lint
0 errors
1 pre-existing react-hooks warning in src/pages/instance/topic.tsx
```
Targeted ESLint and Prettier checks pass. `git diff --check` passes.
Tests are deterministic unit/controller/UI tests. No live Broker or Proxy
cluster is claimed.
Closes #1947.
--
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]