Stephanie0002 opened a new pull request, #8225: URL: https://github.com/apache/rocketmq/pull/8225
<!-- Please make sure the target branch is right. In most case, the target branch should be `develop`. --> ### Which Issue(s) This PR Fixes <!-- Please ensure that the related issue has already been created, and [link this pull request to that issue using keywords](<https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>) to ensure automatic closure. --> Fixes #8223 ### Brief Description <!-- Write a brief description for your pull request to help the maintainer understand the reasons behind your changes. --> Add two metrics rocketmq_active_topic_number and rocketmq_active_subscription_number as following: | Type | Name | Unit | Description | Label | | --------- | -------------- | ----------- |-----------| ------- | | Gauge | rocketmq_active_topic_number | count | The number of current topics | cluster,node_type,node_id | | Gauge | rocketmq_active_subscription_number | count | The number of current subscription group | cluster,node_type,node_id | ### How Did You Test This Change? <!-- In order to ensure the code quality of Apache RocketMQ, we expect every pull request to have undergone thorough testing. --> 1. **Anticipated use of gauge type metric** Gauge: A metric that can be incremented or decremented, used to describe the current state of a particular indicator, such as the remaining system memory. 2. **Add metric variables to the BrokerMetricsManager class**: `activeTopicNum`, `activeSubGroupNum` 3. **Add corresponding constants to the BrokerMetricsConstant class** 4. **Build corresponding metrics inside the `initStatsMetrics` method of the BrokerMetricsManager class** 5. **Write a gauge update callback function that refreshes periodically** a. Call `this.brokerController.topicConfigManager.getTopicConfigTable().size()` to retrieve the number of topics. b. Call `brokerController.getSubscriptionGroupManager().getSubscriptionGroupTable().size()` to obtain the number of subscription groups. -- 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 For queries about this service, please contact Infrastructure at: us...@infra.apache.org