You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "unbridled-41 (via GitHub)" <gi...@apache.org> on 2026/10/03 01:23:55 UTC
[PR] fix(metrics): count brokers instead of timeseries on the overview dashboard [rocketmq-dashboard]
unbridled-41 opened a new pull request, #5421:
URL: https://github.com/apache/rocketmq-dashboard/pull/5421
## Problem / Evidence
The bundled "RocketMQ Cluster Overview" dashboard (`server/src/main/resources/grafana/rocketmq-overview.json:316`, generated by `server/scripts/gen_grafana_dashboards.py:176`) shows a stat panel titled **Broker Count** computed as:
```
count(rocketmq_messages_in_total{cluster="$cluster"})
```
`rocketmq_messages_in_total` carries a `broker` label *and* a `topic` label — the very same dashboard derives its `$broker` and `$topic` template variables from that metric (`"query": "label_values(rocketmq_messages_in_total{cluster=\"$cluster\"}, broker)"` and `..., topic)`). `count()` therefore counts broker/topic series, not brokers: a two-broker cluster with 300 topics renders **600** as the broker count.
The neighbouring panel makes the intended idiom explicit — "Total Topics" is `count(count by (topic) (rocketmq_messages_in_total{cluster="$cluster"}))`.
The dashboard is user-facing: `GrafanaDashboardController` lists it, serves its JSON and packs the whole set into `rocketmq-grafana-dashboards.zip` for import into Grafana.
## Root cause / Fix
A bare `count()` was used where a distinct-label count was intended. Fix:
```
count(count by (broker) (rocketmq_messages_in_total{cluster="$cluster"}))
```
Changed in the generator and the checked-in JSON regenerated from it (the only line that differs).
## Priority & scoring
PRIORITY 61 = 影响 20 (a headline cluster stat is wrong by orders of magnitude) + 波及 9 (overview dashboard shipped to every user who imports the bundle) + 可复现 20 (deterministic PromQL semantics) + 维护价值 12.
FIX_CONFIDENCE 90: standard distinct-count idiom matching the adjacent panel; no layout, uid or title change.
## Tests
```
cd server/scripts && python3 -m unittest test_gen_grafana_dashboards
```
- Red before the fix: `'count(count by (broker) (rocketmq_messages_in_total{cluster="$cluster"}))' != 'count(rocketmq_messages_in_total{cluster="$cluster"})'`
- Green after: `Ran 5 tests ... OK`
- Regenerating all 12 dashboards reproduces the checked-in `server/src/main/resources/grafana` directory byte for byte (`diff -rq` clean).
## Risk
Low. One `expr` string in one panel; panel id, title, unit and layout are untouched, so dashboard imports/overwrites behave identically.
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(metrics): count brokers instead of timeseries on the overview dashboard [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #5421:
URL: https://github.com/apache/rocketmq-dashboard/pull/5421
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(metrics): count brokers instead of timeseries on the overview dashboard [rocketmq-dashboard]
Posted by "unbridled-41 (via GitHub)" <gi...@apache.org>.
unbridled-41 commented on PR #5421:
URL: https://github.com/apache/rocketmq-dashboard/pull/5421#issuecomment-5965543284
### CI status of this PR
`Backend Tests (Java 21)` — **pass**; the change-specific command and its result are in the Tests section of the description.
The three remaining red jobs are red for every branch, including `rocketmq-studio` itself, with the same logs:
- `Backend Build (Java 21)` — fails inside the `binary-license-gate` antrun step (`exec returned: 1`); it also fails on a docs-only PR of this batch, and is addressed independently by #5341.
- `Frontend Build (Node 20)` — fails after a successful build in the license manifest check (`license gate: build artifact verification failed: assets/index-<hash>.js`); it fails identically on a docs-only PR of this batch (run 37088829422) and on trunk, and is addressed independently by #5346.
- `Frontend Docker Build` — depends on the frontend build above.
This diff touches `server/`, so none of the three can be caused by it.
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org