Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #8223] Add two metrics rocketmq_topic_number and rocketmq_consumer_group_number #8225

Merged
merged 13 commits into from
May 31, 2024

Conversation

Stephanie0002
Copy link
Contributor

@Stephanie0002 Stephanie0002 commented May 29, 2024

Which Issue(s) This PR Fixes

Fixes #8223

Brief Description

Add two metrics rocketmq_topic_number and rocketmq_consumer_group_number as following:

Type Name Unit Description Label
Gauge rocketmq_topic_number count The number o topics cluster,node_type,node_id
Gauge rocketmq_consumer_group_number count The number of consumer group cluster,node_type,node_id

How Did You Test This Change?

  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.

@codecov-commenter
Copy link

codecov-commenter commented May 29, 2024

Codecov Report

Attention: Patch coverage is 41.11111% with 53 lines in your changes missing coverage. Please review.

Project coverage is 42.90%. Comparing base (9c8fdb7) to head (41ade60).
Report is 102 commits behind head on develop.

Files Patch % Lines
.../rocketmq/broker/metrics/BrokerMetricsManager.java 9.09% 40 Missing ⚠️
...ocketmq/broker/processor/AdminBrokerProcessor.java 66.66% 8 Missing and 5 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #8225      +/-   ##
=============================================
- Coverage      42.94%   42.90%   -0.05%     
+ Complexity     10383    10377       -6     
=============================================
  Files           1270     1271       +1     
  Lines          88727    88785      +58     
  Branches       11407    11408       +1     
=============================================
- Hits           38108    38095      -13     
- Misses         45925    45988      +63     
- Partials        4694     4702       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

黄梓淇 added 4 commits May 30, 2024 18:01
…ription_number

Signed-off-by: 黄梓淇 <me@U-0MV57FM9-2309.local>
# Conflicts:
#	broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsConstant.java
#	broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java
Signed-off-by: 黄梓淇 <me@U-0MV57FM9-2309.local>
@Stephanie0002 Stephanie0002 changed the title [ISSUE #8223] Add two metrics rocketmq_active_topic_number and rocketmq_active_subscription_number [ISSUE #8223] Add two metrics rocketmq_topic_number and rocketmq_consumer_group_number May 31, 2024
@RongtongJin RongtongJin merged commit a430796 into apache:develop May 31, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Add two metrics rocketmq_active_topic_number and rocketmq_active_subscription_number
4 participants