Skip to content

[ISSUE #10492] Add debug logging for swallowed exceptions in StatsAllSubCommand#10493

Open
SGloria wants to merge 1 commit into
apache:developfrom
SGloria:fix/add-logging-statsall-swallowed-exceptions
Open

[ISSUE #10492] Add debug logging for swallowed exceptions in StatsAllSubCommand#10493
SGloria wants to merge 1 commit into
apache:developfrom
SGloria:fix/add-logging-statsall-swallowed-exceptions

Conversation

@SGloria

@SGloria SGloria commented Jun 12, 2026

Copy link
Copy Markdown

Summary

  • Add debug-level logging to 4 empty catch (Exception e) blocks in StatsAllSubCommand.java
  • Include contextual information (topic name, consumer group, broker address) in log messages
  • Improve observability for the mqadmin statsAll command when partial failures occur

Motivation

When using mqadmin statsAll, if some brokers are temporarily unavailable or return errors, exceptions are silently swallowed. Operators have no way to know whether the output is complete or partially missing. By adding debug-level logging, we preserve the existing behavior (no visible output change by default) while enabling troubleshooting when needed.

Changes

  • tools/src/main/java/org/apache/rocketmq/tools/command/stats/StatsAllSubCommand.java:
    • Added Logger field using LoggerFactory
    • Added log.debug(...) with exception details in all 4 previously empty catch blocks

Test Plan

  • Code compiles without errors
  • No behavioral change at default log level (INFO/WARN)
  • Debug-level logging provides useful diagnostic context when enabled

Fixes #10492

…atsAllSubCommand

Previously, multiple catch blocks in StatsAllSubCommand silently
swallowed exceptions, making it difficult to diagnose issues when
the `mqadmin statsAll` command failed to retrieve statistics from
certain brokers.

This commit adds debug-level logging to all empty catch blocks,
recording the exception details along with contextual information
(topic, group, broker address) to improve observability.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.06%. Comparing base (343daa9) to head (84f35f8).
⚠️ Report is 57 commits behind head on develop.

Files with missing lines Patch % Lines
...cketmq/tools/command/stats/StatsAllSubCommand.java 0.00% 5 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10493      +/-   ##
=============================================
- Coverage      49.03%   48.06%   -0.98%     
+ Complexity     13471    13328     -143     
=============================================
  Files           1375     1377       +2     
  Lines         100381   100712     +331     
  Branches       12965    13010      +45     
=============================================
- Hits           49223    48404     -819     
- Misses         45172    46359    +1187     
+ Partials        5986     5949      -37     

☔ 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.

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.

[Enhancement] Add logging for swallowed exceptions in StatsAllSubCommand

3 participants