[ISSUE #6394]🚀Implement GetBrokerLiteInfo Command for Lite Topic Broker Monitoring#6504
[ISSUE #6394]🚀Implement GetBrokerLiteInfo Command for Lite Topic Broker Monitoring#6504
Conversation
|
🔊@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💥. |
…Broker Monitoring
df72059 to
5593ebf
Compare
WalkthroughThis PR implements the Changes
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 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
📒 Files selected for processing (6)
rocketmq-client/src/admin/default_mq_admin_ext_impl.rsrocketmq-client/src/implementation/mq_client_api_impl.rsrocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/admin/default_mq_admin_ext.rsrocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands.rsrocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/lite.rsrocketmq-tools/rocketmq-admin/rocketmq-admin-core/src/commands/lite/get_broker_lite_info_sub_command.rs
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
rocketmq-rust-bot
left a comment
There was a problem hiding this comment.
LGTM - All CI checks passed ✅
Which Issue(s) This PR Fixes(Closes)
Brief Description
How Did You Test This Change?
Summary by CodeRabbit
getBrokerLiteInfocommand to query broker lightweight information