Skip to content

Commit

Permalink
feat: cluster node list now includes advertise address (#551)
Browse files Browse the repository at this point in the history
Signed-off-by: Li Zhanhui <lizhanhui@gmail.com>
  • Loading branch information
lizhanhui authored Nov 2, 2023
1 parent 107ce5c commit 1e0bcb1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/src/main/java/com/automq/rocketmq/cli/ConsoleHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static void printCluster(Cluster cluster) {
AsciiTable nodeTable = new AsciiTable();
nodeTable.addRule();
row = nodeTable.addRow("NODE ID", "NODE NAME", "TOPIC QUANTITY", "QUEUE QUANTITY",
"STREAM QUANTITY", "LAST HEARTBEAT", "ROLE", "EPOCH", "EXPIRATION");
"STREAM QUANTITY", "LAST HEARTBEAT", "ROLE", "EPOCH", "EXPIRATION", "ADDRESS");

alignCentral(row);

Expand All @@ -87,7 +87,7 @@ public static void printCluster(Cluster cluster) {
boolean isLeader = node.getId() == cluster.getLease().getNodeId();
row = nodeTable.addRow(node.getId(), node.getName(), node.getTopicNum(), node.getQueueNum(), node.getStreamNum(),
toDate(node.getLastHeartbeat()), isLeader ? "Leader" : "Worker", isLeader ? cluster.getLease().getEpoch() : "",
isLeader ? toDate(cluster.getLease().getExpirationTimestamp()) : "");
isLeader ? toDate(cluster.getLease().getExpirationTimestamp()) : "", node.getAddress());
alignCentral(row);
}
nodeTable.addRule();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ public CompletableFuture<Cluster> describeCluster(DescribeClusterRequest request
.setQueueNum(topicManager.queueNumOfNode(entry.getKey()))
.setStreamNum(topicManager.streamNumOfNode(entry.getKey()))
.setGoingAway(brokerNode.isGoingAway())
.setAddress(brokerNode.getNode().getAddress())
.build();
builder.addNodes(node);
}
Expand Down
3 changes: 3 additions & 0 deletions proto/src/main/proto/admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ message Node {

// Timestamp that the leader receives heartbeat from this node
google.protobuf.Timestamp last_heartbeat = 7;

// Advertise address
string address = 8;
}

message ClusterSummary {
Expand Down

0 comments on commit 1e0bcb1

Please # to comment.