Add voting metrics and -h/--help to get usage for client.sh script

This commit is contained in:
Stephen Akridge 2018-08-05 17:56:54 +00:00 committed by sakridge
parent 4c4b0f551e
commit 210b9d346f
2 changed files with 21 additions and 7 deletions

View File

@ -1,12 +1,12 @@
#!/bin/bash -e #!/bin/bash -e
# #
# usage: $0 [leader_url] [num_nodes] [--loop] [extra args] USAGE=" usage: $0 [leader_url] [num_nodes] [--loop] [extra args]
#
# leader_url URL to the leader (defaults to ..) leader_url URL to the leader (defaults to ..)
# num_nodes Minimum number of nodes to look for while converging num_nodes Minimum number of nodes to look for while converging
# --loop Add this flag to cause the program to loop infinitely --loop Add this flag to cause the program to loop infinitely
# "extra args" Any additional arguments are pass along to solana-bench-tps \"extra args\" Any additional arguments are pass along to solana-bench-tps
# "
here=$(dirname "$0") here=$(dirname "$0")
# shellcheck source=multinode-demo/common.sh # shellcheck source=multinode-demo/common.sh
@ -14,6 +14,10 @@ source "$here"/common.sh
leader=$1 leader=$1
if [[ -n $leader ]]; then if [[ -n $leader ]]; then
if [[ $leader == "-h" || $leader == "--help" ]]; then
echo "$USAGE"
exit 0
fi
shift shift
else else
if [[ -d "$SNAP" ]]; then if [[ -d "$SNAP" ]]; then

View File

@ -76,6 +76,16 @@ fn get_last_id_to_vote_on(
super_majority_index, super_majority_index,
); );
metrics::submit(
influxdb::Point::new("vote_stage-peer_count")
.add_field("total_peers", influxdb::Value::Integer(ids.len() as i64))
.add_field(
"valid_peers",
influxdb::Value::Integer(valid_ids.len() as i64),
)
.to_owned(),
);
if valid_ids.len() > super_majority_index { if valid_ids.len() > super_majority_index {
*last_vote = now; *last_vote = now;