Skip to content

[Feature] Add two metrics rocketmq_active_topic_number and rocketmq_active_subscription_number #8223

Closed

Description

@Stephanie0002

Is Your Feature Request Related to a Problem?

The existing observable system of this project lacks broker-side monitoring of the number of topic and subscription group.

Describe the Solution You'd Like

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

Describe Alternatives You've Considered

  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.

Additional Context

No response

Activity

  1. humkum commented on May 30, 2024

    @humkum
    Contributor

    Here you can only get the total number of topics and subscription groups, but cannot determine whether these topics and subscription groups are active. Would it be more accurate to call it rocketmq_total_topic_number & rocketmq_total_subscription_number?

  2. added a commit that references this issue on May 31, 2024
  3. added a commit that references this issue on Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions