You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by ji...@apache.org on 2021/02/14 12:45:07 UTC
[rocketmq] branch develop updated: [ISSUE #2670]Hide Client IP when
there's no `-s true` in command ConsumerProgress
This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 0d8a184 [ISSUE #2670]Hide Client IP when there's no `-s true` in command ConsumerProgress
0d8a184 is described below
commit 0d8a184ad1e706262c3c79697fd34c75e8bf6cfb
Author: william.z <zw...@gmail.com>
AuthorDate: Sun Feb 14 20:44:48 2021 +0800
[ISSUE #2670]Hide Client IP when there's no `-s true` in command ConsumerProgress
Co-authored-by: zhuweilin <zh...@iie.ac.cn>
---
.../consumer/ConsumerProgressSubCommand.java | 64 ++++++++++++++--------
1 file changed, 42 insertions(+), 22 deletions(-)
diff --git a/tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java b/tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java
index b946ee1..7985f9d 100644
--- a/tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java
+++ b/tools/src/main/java/org/apache/rocketmq/tools/command/consumer/ConsumerProgressSubCommand.java
@@ -111,17 +111,26 @@ public class ConsumerProgressSubCommand implements SubCommand {
if (showClientIP) {
messageQueueAllocationResult = getMessageQueueAllocationResult(defaultMQAdminExt, consumerGroup);
}
-
- System.out.printf("%-32s %-32s %-4s %-20s %-20s %-20s %-20s %s%n",
- "#Topic",
- "#Broker Name",
- "#QID",
- "#Broker Offset",
- "#Consumer Offset",
- "#Client IP",
- "#Diff",
- "#LastTime");
-
+ if (showClientIP) {
+ System.out.printf("%-32s %-32s %-4s %-20s %-20s %-20s %-20s %s%n",
+ "#Topic",
+ "#Broker Name",
+ "#QID",
+ "#Broker Offset",
+ "#Consumer Offset",
+ "#Client IP",
+ "#Diff",
+ "#LastTime");
+ } else {
+ System.out.printf("%-32s %-32s %-4s %-20s %-20s %-20s %s%n",
+ "#Topic",
+ "#Broker Name",
+ "#QID",
+ "#Broker Offset",
+ "#Consumer Offset",
+ "#Diff",
+ "#LastTime");
+ }
long diffTotal = 0L;
for (MessageQueue mq : mqList) {
OffsetWrapper offsetWrapper = consumeStats.getOffsetTable().get(mq);
@@ -141,17 +150,28 @@ public class ConsumerProgressSubCommand implements SubCommand {
if (showClientIP) {
clientIP = messageQueueAllocationResult.get(mq);
}
-
- System.out.printf("%-32s %-32s %-4d %-20d %-20d %-20s %-20d %s%n",
- UtilAll.frontStringAtLeast(mq.getTopic(), 32),
- UtilAll.frontStringAtLeast(mq.getBrokerName(), 32),
- mq.getQueueId(),
- offsetWrapper.getBrokerOffset(),
- offsetWrapper.getConsumerOffset(),
- null != clientIP ? clientIP : "N/A",
- diff,
- lastTime
- );
+ if (showClientIP) {
+ System.out.printf("%-32s %-32s %-4d %-20d %-20d %-20s %-20d %s%n",
+ UtilAll.frontStringAtLeast(mq.getTopic(), 32),
+ UtilAll.frontStringAtLeast(mq.getBrokerName(), 32),
+ mq.getQueueId(),
+ offsetWrapper.getBrokerOffset(),
+ offsetWrapper.getConsumerOffset(),
+ null != clientIP ? clientIP : "N/A",
+ diff,
+ lastTime
+ );
+ } else {
+ System.out.printf("%-32s %-32s %-4d %-20d %-20d %-20d %s%n",
+ UtilAll.frontStringAtLeast(mq.getTopic(), 32),
+ UtilAll.frontStringAtLeast(mq.getBrokerName(), 32),
+ mq.getQueueId(),
+ offsetWrapper.getBrokerOffset(),
+ offsetWrapper.getConsumerOffset(),
+ diff,
+ lastTime
+ );
+ }
}
System.out.printf("%n");