tju-yxq opened a new pull request, #1405: URL: https://github.com/apache/rocketmq-dashboard/pull/1405
## What is the purpose of the change Fixes #1404 The `alertName()` method strips non-alphanumeric characters from rule names, causing collisions when two rules normalize to the same name (e.g., `"Broker Down!"` and `"Broker_Down"` both become `"BrokerDown"`). Prometheus rejects rule files with duplicate alert names within the same group, causing the entire rules file to fail to load. ## Brief changelog - **`AlertService.java`**: Added `ensureUniqueAlertName()` helper that tracks used alert names per group and appends `_2`, `_3`, etc. suffixes to resolve collisions. - **`AlertService.java`**: Modified `exportPrometheusRulesYaml()` to use the helper instead of raw `rule.alert()`. ## Verifying this change 1. Create two alert rules with names that normalize to the same string (e.g., `"Consumer Lag!"` and `"Consumer Lag?"`). 2. Export the Prometheus rules YAML. 3. Before fix: both rules have `alert: ConsumerLag` - Prometheus rejects. 4. After fix: rules have `alert: ConsumerLag` and `alert: ConsumerLag_2` - Prometheus accepts. - [x] Make sure there is a Github issue filed for the change. - [x] Format the pull request title like `[ISSUE #1404] ...`. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit-test to verify your logic correction. - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. - [ ] If this contribution is large, please file an Apache Individual Contributor License Agreement. -- 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]
