asapple opened a new issue, #9033: URL: https://github.com/apache/rocketmq/issues/9033
### Before Creating the Enhancement Request - [X] I have confirmed that this should be classified as an enhancement rather than a bug/feature. ### Summary Refactor the LmqBrokerStatsManager class to eliminate redundant code related to checking and modifying the group and topic values based on the brokerConfig.isEnableLmqStats() flag. This will improve code readability, maintainability, and reduce the likelihood of bugs due to duplicated logic. ### Motivation The current implementation of the LmqBrokerStatsManager class contains duplicate code across multiple methods, specifically regarding the conditional check for brokerConfig.isEnableLmqStats() and the subsequent modification of group and topic. This duplication makes the code harder to maintain, more error-prone, and increases the difficulty of future changes. Refactoring the duplicated logic into a single helper method would enhance maintainability and reduce technical debt. ### Describe the Solution You'd Like Refactor the LmqBrokerStatsManager class by extracting the common logic that modifies the group and topic values into a private helper method. Replace the redundant logic in the incGroupGetNums, incGroupGetSize, incGroupAckNums, incGroupCkNums, incGroupGetLatency, incSendBackNums, tpsGroupGetNums, recordDiskFallBehindTime, and recordDiskFallBehindSize methods with calls to the private helper method. ### Describe Alternatives You've Considered null ### Additional Context The LmqBrokerStatsManager class is responsible for tracking statistics related to groups and topics, and the modifications to group and topic are a part of this logic. Ensuring the code is DRY will help reduce future maintenance costs and potential bugs. -- 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-unsubscr...@rocketmq.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org