Skip to content

Commit

Permalink
bring the stats back
Browse files Browse the repository at this point in the history
  • Loading branch information
achamayou committed Aug 8, 2023
1 parent 87144a6 commit 74e6f08
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/infra/basicperf.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def create_and_add_node(network, host, old_primary, snapshots_dir, statistics):
snapshots_dir=snapshots_dir,
)
LOG.info(f"Replace node {old_primary.local_node_id} with {node.local_node_id}")
network.replace_stopped_node(old_primary, node, args)
network.replace_stopped_node(old_primary, node, args, statistics=statistics)
LOG.info(f"Done replacing node: {host}")


Expand Down Expand Up @@ -356,7 +356,7 @@ def run(args):
old_primary = primary
primary, _ = network.wait_for_new_primary(primary)
statistics[
"new_primary_election_time"
"new_primary_detected_time"
] = datetime.datetime.now().isoformat()
if args.add_new_node_after_primary_stops:
create_and_add_node(
Expand Down
12 changes: 11 additions & 1 deletion tests/infra/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,8 @@ def replace_stopped_node(
args,
valid_from=None,
validity_period_days=None,
no_wait=False,
timeout=5,
statistics=None,
):
primary, _ = self.find_primary()
try:
Expand All @@ -972,6 +972,10 @@ def replace_stopped_node(
# Note: Timeout is function of the ledger size here since
# the commit of the trust_node proposal may rely on the new node
# catching up (e.g. adding 1 node to a 1-node network).
if statistics is not None:
statistics[
"node_replacement_governance_start"
] = datetime.now().isoformat()
self.consortium.replace_node(
primary,
node_to_retire,
Expand All @@ -980,6 +984,10 @@ def replace_stopped_node(
validity_period_days=validity_period_days,
timeout=args.ledger_recovery_timeout,
)
if statistics is not None:
statistics[
"node_replacement_governance_committed"
] = datetime.now().isoformat()
except (ValueError, TimeoutError):
LOG.error(
f"NFailed to replace {node_to_retire.node_id} with {node_to_add.node_id}"
Expand Down Expand Up @@ -1008,6 +1016,8 @@ def replace_stopped_node(
time.sleep(0.1)
else:
raise TimeoutError(f"Timed out waiting for node to become removed: {r}")
if statistics is not None:
statistics["old_node_removal_committed"] = datetime.now().isoformat()
self.nodes.remove(node_to_retire)

def create_user(self, local_user_id, curve, record=True):
Expand Down

0 comments on commit 74e6f08

Please sign in to comment.