未验证 提交 0d8a184a 编写于 作者: W william.z 提交者: GitHub

[ISSUE #2670]Hide Client IP when there's no `-s true` in command ConsumerProgress

Co-authored-by: Nzhuweilin <zhuweilin@iie.ac.cn>
上级 3a09c35a
...@@ -111,17 +111,26 @@ public class ConsumerProgressSubCommand implements SubCommand { ...@@ -111,17 +111,26 @@ public class ConsumerProgressSubCommand implements SubCommand {
if (showClientIP) { if (showClientIP) {
messageQueueAllocationResult = getMessageQueueAllocationResult(defaultMQAdminExt, consumerGroup); messageQueueAllocationResult = getMessageQueueAllocationResult(defaultMQAdminExt, consumerGroup);
} }
if (showClientIP) {
System.out.printf("%-32s %-32s %-4s %-20s %-20s %-20s %-20s %s%n", System.out.printf("%-32s %-32s %-4s %-20s %-20s %-20s %-20s %s%n",
"#Topic", "#Topic",
"#Broker Name", "#Broker Name",
"#QID", "#QID",
"#Broker Offset", "#Broker Offset",
"#Consumer Offset", "#Consumer Offset",
"#Client IP", "#Client IP",
"#Diff", "#Diff",
"#LastTime"); "#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; long diffTotal = 0L;
for (MessageQueue mq : mqList) { for (MessageQueue mq : mqList) {
OffsetWrapper offsetWrapper = consumeStats.getOffsetTable().get(mq); OffsetWrapper offsetWrapper = consumeStats.getOffsetTable().get(mq);
...@@ -141,17 +150,28 @@ public class ConsumerProgressSubCommand implements SubCommand { ...@@ -141,17 +150,28 @@ public class ConsumerProgressSubCommand implements SubCommand {
if (showClientIP) { if (showClientIP) {
clientIP = messageQueueAllocationResult.get(mq); clientIP = messageQueueAllocationResult.get(mq);
} }
if (showClientIP) {
System.out.printf("%-32s %-32s %-4d %-20d %-20d %-20s %-20d %s%n", System.out.printf("%-32s %-32s %-4d %-20d %-20d %-20s %-20d %s%n",
UtilAll.frontStringAtLeast(mq.getTopic(), 32), UtilAll.frontStringAtLeast(mq.getTopic(), 32),
UtilAll.frontStringAtLeast(mq.getBrokerName(), 32), UtilAll.frontStringAtLeast(mq.getBrokerName(), 32),
mq.getQueueId(), mq.getQueueId(),
offsetWrapper.getBrokerOffset(), offsetWrapper.getBrokerOffset(),
offsetWrapper.getConsumerOffset(), offsetWrapper.getConsumerOffset(),
null != clientIP ? clientIP : "N/A", null != clientIP ? clientIP : "N/A",
diff, diff,
lastTime 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"); System.out.printf("%n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册