Skip to content

Commit

Permalink
Add metric is_leader
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyWoo committed Mar 24, 2024
1 parent db847a6 commit 6bd760a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/how-to-monitor-and-manage.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ zk_packets_sent 60406965
zk_num_alive_connections 0
zk_outstanding_requests 0
zk_server_state leader
zk_is_leader 1
zk_znode_count 2899570
zk_watch_count 0
zk_ephemerals_count 41933
Expand Down
1 change: 1 addition & 0 deletions src/Service/FourLetterCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ String MonitorCommand::run()
print(ret, "outstanding_requests", keeper_info.outstanding_requests_count);

print(ret, "server_state", keeper_info.getRole());
print(ret, "is_leader", keeper_info.is_leader);

print(ret, "znode_count", state_machine.getNodesCount());
print(ret, "watch_count", state_machine.getTotalWatchesCount());
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_four_word_command/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def test_cmd_mntr(started_cluster):
assert int(result["zk_outstanding_requests"]) == 0

assert result["zk_server_state"] == "leader"
assert result["zk_is_leader"] == "1"

# contains:
# 10 nodes created by test
Expand Down

0 comments on commit 6bd760a

Please sign in to comment.