Skip to content

[ISSUE #6394]🚀Implement GetBrokerLiteInfo Command for Lite Topic Broker Monitoring#6504

Merged
mxsm merged 1 commit intomxsm:mainfrom
WaterWhisperer:feat-6394
Feb 24, 2026
Merged

[ISSUE #6394]🚀Implement GetBrokerLiteInfo Command for Lite Topic Broker Monitoring#6504
mxsm merged 1 commit intomxsm:mainfrom
WaterWhisperer:feat-6394

Conversation

@WaterWhisperer
Copy link
Contributor

@WaterWhisperer WaterWhisperer commented Feb 24, 2026

Which Issue(s) This PR Fixes(Closes)

Brief Description

How Did You Test This Change?

Summary by CodeRabbit

  • New Features
    • Added getBrokerLiteInfo command to query broker lightweight information
    • Support for targeting specific broker addresses or entire clusters
    • Optional detailed view displays per-topic and per-group metrics

@rocketmq-rust-robot rocketmq-rust-robot added the feature🚀 Suggest an idea for this project. label Feb 24, 2026
@rocketmq-rust-bot
Copy link
Collaborator

🔊@WaterWhisperer 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

Walkthrough

This PR implements the getBrokerLiteInfo command for monitoring Lite Topic information in RocketMQ brokers. Changes span from low-level MQ client API wiring through admin interfaces to a complete CLI command implementation supporting both individual broker and cluster-wide queries.

Changes

Cohort / File(s) Summary
Client API Layer
rocketmq-client/src/implementation/mq_client_api_impl.rs, rocketmq-client/src/admin/default_mq_admin_ext_impl.rs, rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/admin/default_mq_admin_ext.rs
Added GetBrokerLiteInfoResponseBody import and new get_broker_lite_info() method in MQClientAPIImpl to invoke the broker API; wired through admin interface layers to expose the functionality. Parameter names corrected from underscore to active use (_broker_addr → broker_addr). Note: duplication reported in mq_client_api_impl.rs requires verification.
CLI Command Infrastructure
rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands.rs, rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/lite.rs
Introduced new Lite command namespace via enum variant Commands::Lite(lite::LiteCommands) and command dispatcher routing; registered "getBrokerLiteInfo" command in the command classification table with execution dispatch logic.
Broker Lite Info Subcommand
rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/lite/get_broker_lite_info_sub_command.rs
Implemented GetBrokerLiteInfoSubCommand with conditional logic for broker-address and cluster-name query modes, formatted table output with header/row printing, optional detailed metadata display, and per-broker error handling in cluster operations.

Sequence Diagram

sequenceDiagram
    participant CLI as CLI Handler
    participant AdminCmd as LiteCommands
    participant SubCmd as GetBrokerLiteInfoSubCommand
    participant Admin as DefaultMQAdminExt
    participant API as MQClientAPIImpl
    participant Broker as RocketMQ Broker

    CLI->>AdminCmd: execute(rpc_hook)
    AdminCmd->>SubCmd: execute(rpc_hook)
    SubCmd->>SubCmd: initialize MQAdminExt
    SubCmd->>Admin: start()
    Admin->>Admin: ready
    
    alt Broker Address Mode
        SubCmd->>Admin: get_broker_lite_info(broker_addr)
        Admin->>API: get_broker_lite_info(addr, timeout)
        API->>Broker: GetBrokerLiteInfo request
        Broker->>API: response body
        API->>Admin: GetBrokerLiteInfoResponseBody
        Admin->>SubCmd: metrics
        SubCmd->>SubCmd: print_row(metrics)
    else Cluster Name Mode
        SubCmd->>Admin: fetch_broker_cluster_info()
        Admin->>Admin: cluster info
        SubCmd->>SubCmd: iterate master addrs
        loop For each master
            SubCmd->>Admin: get_broker_lite_info(master_addr)
            Admin->>API: get_broker_lite_info(addr, timeout)
            API->>Broker: GetBrokerLiteInfo request
            Broker->>API: response body
            API->>Admin: GetBrokerLiteInfoResponseBody
            Admin->>SubCmd: metrics
            SubCmd->>SubCmd: print_row(metrics)
        end
    end
    
    SubCmd->>Admin: shutdown()
    Admin->>SubCmd: shutdown complete
    SubCmd->>SubCmd: return RocketMQResult
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 The Lite Topic monitor hops into view,
With broker-wide metrics and cluster queues too,
From API to CLI, each layer aligned—
Light Message Queues dancing in perfect time.
Capacity tracking, subscriptions on display,
Happy admins monitoring the RocketMQ way! 🚀✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: implementing a GetBrokerLiteInfo command for Lite Topic broker monitoring, which aligns with the primary objective of the PR.
Linked Issues check ✅ Passed The PR implements all core requirements from #6394: GetBrokerLiteInfo command with broker-addr and cluster parameters, optional show-detail flag, metric collection, cluster-wide querying, and proper error handling.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the GetBrokerLiteInfo command feature. No unrelated modifications to unrelated modules or functionality are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/lite/get_broker_lite_info_sub_command.rs (1)

88-98: Surface per-broker error details to aid diagnostics.

Right now failures emit a generic “error” line, which makes troubleshooting harder. Consider printing the error message (ideally to stderr) while still continuing.

💡 Proposed tweak to include error details
-                    Err(_) => {
-                        println!("[{}] error.", broker_addr);
-                    }
+                    Err(err) => {
+                        eprintln!("[{}] error: {}", broker_addr, err);
+                    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/lite/get_broker_lite_info_sub_command.rs`
around lines 88 - 98, Replace the generic Err(_) branch in the loop over
master_set that calls default_mqadmin_ext.get_broker_lite_info so it captures
the error (e.g., Err(e)) and prints a descriptive message with e for that broker
(use broker_addr and function context) to stderr (e.g., eprintln!) while still
continuing the loop; keep the Ok branch using Self::print_row(&response_body,
broker_addr, show_detail) unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/lite/get_broker_lite_info_sub_command.rs`:
- Around line 88-98: Replace the generic Err(_) branch in the loop over
master_set that calls default_mqadmin_ext.get_broker_lite_info so it captures
the error (e.g., Err(e)) and prints a descriptive message with e for that broker
(use broker_addr and function context) to stderr (e.g., eprintln!) while still
continuing the loop; keep the Ok branch using Self::print_row(&response_body,
broker_addr, show_detail) unchanged.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 714ebe6 and 5593ebf.

📒 Files selected for processing (6)
  • rocketmq-client/src/admin/default_mq_admin_ext_impl.rs
  • rocketmq-client/src/implementation/mq_client_api_impl.rs
  • rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/admin/default_mq_admin_ext.rs
  • rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands.rs
  • rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/lite.rs
  • rocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/lite/get_broker_lite_info_sub_command.rs

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 0% with 110 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.22%. Comparing base (33efdf4) to head (5593ebf).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
.../commands/lite/get_broker_lite_info_sub_command.rs 0.00% 72 Missing ⚠️
...mq-client/src/implementation/mq_client_api_impl.rs 0.00% 19 Missing ⚠️
...etmq-client/src/admin/default_mq_admin_ext_impl.rs 0.00% 7 Missing ⚠️
...rocketmq-admin/rocketmq-admin-core/src/commands.rs 0.00% 6 Missing ⚠️
...tmq-admin/rocketmq-admin-core/src/commands/lite.rs 0.00% 4 Missing ⚠️
...ketmq-admin-core/src/admin/default_mq_admin_ext.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6504      +/-   ##
==========================================
+ Coverage   42.18%   42.22%   +0.04%     
==========================================
  Files         942      944       +2     
  Lines      131785   131919     +134     
==========================================
+ Hits        55595    55706     +111     
- Misses      76190    76213      +23     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@rocketmq-rust-bot rocketmq-rust-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - All CI checks passed ✅

Copy link
Owner

@mxsm mxsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mxsm mxsm merged commit 93009eb into mxsm:main Feb 24, 2026
9 of 14 checks passed
@rocketmq-rust-bot rocketmq-rust-bot added approved PR has approved and removed ready to review waiting-review waiting review this PR labels Feb 24, 2026
@WaterWhisperer WaterWhisperer deleted the feat-6394 branch February 24, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI review first Ai review pr first approved PR has approved auto merge feature🚀 Suggest an idea for this project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature🚀] Implement GetBrokerLiteInfo Command for Lite Topic Broker Monitoring

4 participants