From 74e6f08aa841fbd3cbac9e9062c5b989070416e5 Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Tue, 8 Aug 2023 12:49:55 +0000 Subject: [PATCH] bring the stats back --- tests/infra/basicperf.py | 4 ++-- tests/infra/network.py | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/infra/basicperf.py b/tests/infra/basicperf.py index 246f19c6d40c..ca11a0fd8521 100644 --- a/tests/infra/basicperf.py +++ b/tests/infra/basicperf.py @@ -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}") @@ -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( diff --git a/tests/infra/network.py b/tests/infra/network.py index 1492adbbd2e3..b7536a796af5 100644 --- a/tests/infra/network.py +++ b/tests/infra/network.py @@ -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: @@ -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, @@ -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}" @@ -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):