You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "elephone-184 (via GitHub)" <gi...@apache.org> on 2026/09/22 14:42:05 UTC
[PR] feat(broker): add cluster broker configuration drift and baseline comparator engine [rocketmq-dashboard]
elephone-184 opened a new pull request, #4975:
URL: https://github.com/apache/rocketmq-dashboard/pull/4975
## What is the purpose of the change
In clustered deployments of RocketMQ, brokers often suffer configuration drift over time due to localized manual restarts, incomplete orchestration rollouts, or divergent default flags (such as `flushDiskType`, `autoCreateTopicEnable`, `maxMessageSize`, and `brokerPermission`). Such divergence introduces subtle failure modes, including broken replication durability, uneven storage retention, and intermittent message rejection.
This PR introduces an automated `BrokerConfigDriftEngine` and configuration audit report:
1. `BrokerConfigAuditReportVO`: Domain report capturing `clusterConsistencyScore` (0.0 to 100.0), drifted property summaries, per-broker actual values, and operational recommendations.
2. `BrokerConfigDriftEngine`: Evaluates live runtime properties retrieved from all reachable brokers in a cluster, identifies deviations against a selected cluster baseline, classifies severity (`CRITICAL`, `HIGH`, `MEDIUM`), and computes consistency health score.
3. Controller & Service wiring: Integrates through `BrokerConfigDiffService.auditClusterConfigDrift` and exposes `/api/clusters/{id}/config-drift-audit` in `ClusterController`.
4. Comprehensive unit test suite covering synchronized clusters, critical divergence (e.g. SYNC vs ASYNC flush), single broker clusters, and controller/service integration.
## Brief changelog
- Add `BrokerConfigAuditReportVO.java` domain model.
- Add `BrokerConfigDriftEngine.java` audit evaluation logic.
- Add `auditClusterConfigDrift` method in `BrokerConfigDiffService`.
- Expose `/api/clusters/{id}/config-drift-audit` endpoint in `ClusterController`.
- Add `BrokerConfigDriftEngineTest.java` and expand `BrokerConfigDiffServiceTest.java` and `ClusterControllerTest.java`.
## Verifying this change
- `BrokerConfigDriftEngineTest`: verifies empty configs, single broker baseline, synchronized cluster score 100%, and multi-property drift detection.
- `BrokerConfigDiffServiceTest`: verifies cluster retrieval, live broker property aggregation, and delegation.
- `ClusterControllerTest`: verifies `/api/clusters/{id}/config-drift-audit` HTTP endpoint response mapping.
--
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] feat(broker): add cluster broker configuration drift and baseline comparator engine [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on PR #4975:
URL: https://github.com/apache/rocketmq-dashboard/pull/4975#issuecomment-5806622000
Closing as a duplicate of what the branch already ships, plus it does not compile.
1. `BrokerConfigDiffService` already does this. Its `COMPARED_FIELDS` (`BrokerConfigDiffService.java:37-46`) covers every property this PR audits — `flushDiskType`, `autoCreateTopicEnable`, `autoCreateSubscriptionGroup`, `maxMessageSize`, `brokerPermission`, `fileReservedTime` — and more (`msgTraceTopicName`, `deleteWhen`, `writeQueueNums`, `readQueueNums`). `compare(clusterId, instanceId)` already pulls live per-broker configs, reports `driftDetected`, `complete`, `brokerCount` vs `reachableBrokerCount`, per-broker reachability with the failure message, and per-field per-broker values (`BrokerConfigDiffVO.java:32-70`), and `ClusterController.java:85` already exposes it. The only genuinely new content here is a consistency score and severity labels; those belong on the existing VO, not on a second service method, second VO family and second endpoint.
2. The new path is also strictly less informative: `catch (Exception ignored) {}` swallows broker-config failures and `totalBrokers`/`onlineBrokers` are both set to the number of brokers whose config was successfully read, so an unreachable broker disappears from the report instead of being reported unreachable.
3. Compile errors: `ClusterConfigVO` has no `getBrokerName()` (`ClusterConfigVO.java:29-39`); `maxMessageSize`, `fileReservedTime` and `brokerPermission` are primitive `int`, so `!= null` is illegal; and `extractValue`'s switch mixes a `FlushDiskType` enum arm with `String` arms.
4. The score formula `100.0 - driftedCount * 16.6` has no stated basis, and all four `BrokerConfigDriftEngineTest` methods are named `testXxx` instead of the `...Test` suffix; they build fixtures on the imagined VO shape, so they cannot compile either.
5. `GET /api/clusters/{id}/config-drift-audit` is not added to `docs/api-spec.md`.
If you want severity and a health score for config drift, please propose them as additional fields on `BrokerConfigDiffVO` produced by the existing `compare` path, keeping the reachability reporting intact.
--
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] feat(broker): add cluster broker configuration drift and baseline comparator engine [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #4975: feat(broker): add cluster broker configuration drift and baseline comparator engine
URL: https://github.com/apache/rocketmq-dashboard/pull/4975
--
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