Skip to content

[ISSUE #11630] fix(tools): report each broker's version in exportMetrics - #11631

Open
Tang-Kin-Long wants to merge 2 commits into
apache:developfrom
Tang-Kin-Long:develop
Open

Tang-Kin-Long wants to merge 2 commits into
apache:developfrom
Tang-Kin-Long:develop

Conversation

@Tang-Kin-Long

Copy link
Copy Markdown

Which Issue(s) This PR Fixes

Brief Description

mqadmin exportMetrics previously wrote the local mqadmin version to every broker's runtimeVersion.rocketmqVersion field in metrics.json. This could make brokers running different versions appear to be on the same release.

The command now reads brokerVersionDesc from each broker's existing runtime stats response. The report format stays the same, and no additional RPC is needed.

How Did You Test This Change?

Ran ExportMetricsCommandTest with two mocked brokers reporting V5_3_2 and V5_4_0. The test executes the export command and reads the generated metrics.json.

Before the fix, the first assertion failed because broker-a was reported as V5_5_1, the local mqadmin version. After the fix, the same test passed and verified the correct version for both brokers.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.91%. Comparing base (e114b54) to head (672ff21).

Files with missing lines Patch % Lines
...tmq/tools/command/export/ExportMetricsCommand.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11631      +/-   ##
=============================================
+ Coverage      50.86%   50.91%   +0.04%     
- Complexity     14881    14889       +8     
=============================================
  Files           1391     1391              
  Lines         103773   103773              
  Branches       13614    13614              
=============================================
+ Hits           52789    52832      +43     
+ Misses         44724    44684      -40     
+ Partials        6260     6257       -3     

☔ View full report in Codecov by Harness.
📢 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.

@Tang-Kin-Long Tang-Kin-Long changed the title fix(tools): report each broker's version in exportMetrics [Issue #11630] fix(tools): report each broker's version in exportMetrics Nov 26, 2026
@Tang-Kin-Long Tang-Kin-Long changed the title [Issue #11630] fix(tools): report each broker's version in exportMetrics [ISSUE #11630] fix(tools): report each broker's version in exportMetrics Nov 26, 2026

@JiangSOBD JiangSOBD left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reading brokerVersionDesc from the existing per-broker runtime stats fixes the local-tool-version mix-up without another RPC. The regression test usefully checks the generated metrics.json for two distinct broker versions. One small follow-up: could you add a case where brokerVersionDesc is absent and define the expected JSON output (for example, an explicit unknown value)? This would keep missing version metadata distinguishable from a real broker version. Review based on the diff; I have not run the tests locally.

@Tang-Kin-Long

Copy link
Copy Markdown
Author

Thanks for your review! Addressed in 89f662478. When a broker does not report brokerVersionDesc, metrics.json now explicitly records "rocketmqVersion": "unknown". I extended the regression test with a third broker that omits the field and kept the assertions for the two brokers that report distinct versions. The new assertion failed before the change, and the updated test passes locally.

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.

[Bug] mqadmin exportMetrics reports the local tool version for every broker

3 participants