tju-yxq opened a new issue, #1407:
URL: https://github.com/apache/rocketmq-dashboard/issues/1407

   ## 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
   
   Similar to the system group filtering issue (#1401), the system **topic** 
filtering is also inconsistent between `RocketMQMetadataProvider` and 
`RocketMQDashboardProvider`. This causes system topics to leak into the topic 
list and inflate the dashboard topic count.
   
   **`RocketMQMetadataProvider`** uses:
   - Prefixes: `RMQ_SYS_`, `SCHEDULE_TOPIC_`, `%RETRY%`, `%DLQ%`, `CID_`
   - Exact match: `TBW102`, `SELF_TEST_TOPIC`, `DefaultCluster`, 
`OFFSET_MOVED_EVENT`, `broker`, `SCHEDULE_TOPIC_XXXX`, 
`RMQ_SYS_TRANS_HALF_TOPIC`, `RMQ_SYS_TRACE_TOPIC`, `RMQ_SYS_TRANS_OP_HALF_TOPIC`
   - Also checks `brokerNames.contains(topicName)` to filter topics that match 
broker names
   
   **`RocketMQDashboardProvider`** uses:
   - Prefixes: `rmq_sys_`, `SCHEDULE_TOPIC_`, `RMQ_SYS_`, `broker_`, `%RETRY%`, 
`%DLQ%`, `TBW102`, `SELF_TEST_TOPIC`, `BenchmarkTest`, `OFFSET_MOVED_EVENT`, 
`DefaultCluster`, `broker-a`, `broker-b`
   - Does NOT check `CID_` prefix
   - Does NOT check broker names as system topics
   - Has hardcoded broker names (`broker-a`, `broker-b`) which are 
environment-specific
   - Does NOT have `RMQ_SYS_TRANS_HALF_TOPIC` or `RMQ_SYS_TRANS_OP_HALF_TOPIC` 
(but `RMQ_SYS_` prefix catches them)
   
   **Key discrepancies:**
   
   - The `CID_` prefix is filtered by `MetadataProvider` but NOT by 
`DashboardProvider`, so `CID_*` topics inflate the dashboard topic count.
   - The `broker_` prefix is in `DashboardProvider` but NOT in 
`MetadataProvider`, so topics like `broker_config` are filtered from the 
dashboard but shown in the topic list.
   - `BenchmarkTest` is only in `DashboardProvider`, so benchmark topics appear 
in the topic list but not the dashboard count.
   - `DashboardProvider` has hardcoded `broker-a` and `broker-b` which are 
environment-specific and wrong for clusters with different broker names.
   - `MetadataProvider` checks broker names from the live cluster topology 
(`brokerNames.contains(topicName)`), but `DashboardProvider` does not, so 
topics named after brokers appear in the dashboard count.
   
   ### Steps to Reproduce
   
   1. Start a RocketMQ cluster.
   2. Observe system topics like `CID_RMQ_SYS_` in the topic list 
(MetadataProvider filters `CID_` but DashboardProvider doesn't).
   3. Open the dashboard overview - the topic count includes system topics that 
should be filtered.
   4. If broker names are not `broker-a`/`broker-b`, topics named after brokers 
appear in the dashboard count.
   
   ### What Did You Expect to See?
   
   System topics should be consistently filtered across both providers using 
the same set of prefixes and patterns, including dynamic broker-name-based 
filtering from the live cluster topology.
   
   ### What Did You See Instead?
   
   Inconsistent filtering causes system topics to leak into user-facing lists 
and inflate dashboard counts.
   
   ### Additional Context
   
   **Related issue**: #1401 (same pattern for system consumer groups, already 
fixed in PR #1402).
   
   **Affected files**:
   - 
`server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQMetadataProvider.java`
 - `SYSTEM_TOPIC_PREFIXES`, `SYSTEM_TOPICS`, `isSystemTopic()`
   - 
`server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQDashboardProvider.java`
 - `SYSTEM_TOPIC_PREFIXES`, `isSystemTopic()`
   
   **Fix approach**:
   
   Extract a shared `SystemTopicFilter` utility class (similar to 
`SystemGroupFilter` from PR #1402) that consolidates all system topic prefixes 
and exact match names. Both providers should use this shared filter. The 
`DashboardProvider` should also accept an optional set of broker names for 
dynamic broker-name-based filtering, matching the `MetadataProvider`'s behavior.
   
   This adds approximately 30 lines (the utility class) and modifies 2 files to 
use it, with no logic deletion.
   


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