Skip to content

[Enhancement] Add logging for swallowed exceptions in StatsAllSubCommand #10492

@SGloria

Description

@SGloria

Before Creating the Enhancement Request

  • I have confirmed that this should be classified as an enhancement rather than a bug/feature.

Summary

In tools/src/main/java/org/apache/rocketmq/tools/command/stats/StatsAllSubCommand.java, there are multiple empty catch (Exception e) blocks (lines 58, 77, 91, 198) that silently swallow exceptions without any logging. This makes it difficult to diagnose issues when the statsAll command fails to retrieve statistics from certain brokers.

Motivation

When using the mqadmin statsAll command, if some brokers are temporarily unavailable or return errors, the exceptions are completely hidden. Users and operators cannot tell whether the statistics output is complete or partially missing due to errors. Adding at least debug-level logging would significantly improve observability and debugging experience.

Describe the Solution You'd Like

Add log.debug() or log.warn() calls in the empty catch blocks to record the exception information, so that operators can enable debug logging to troubleshoot missing statistics data.

Describe Alternatives You've Considered

One alternative is to accumulate errors and print a summary at the end of the command execution, but simple debug logging is less intrusive and more aligned with the existing code style.

Additional Context

Similar empty catch blocks exist in other command files under tools/src/main/java/org/apache/rocketmq/tools/command/, but this issue focuses specifically on StatsAllSubCommand as a starting point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions