From 7727959d4fbc01d9e28bf884ff4e68241860d9fd Mon Sep 17 00:00:00 2001 From: Murali Krishnasamy Date: Tue, 7 Nov 2023 11:21:43 -0500 Subject: [PATCH] setting the index timestamp to timestamp the graph when the control planes are ready this way we can observe any delays between cluster creations that represents the scheduling delays as well --- libs/platforms/rosa/hypershift/hypershift.py | 3 ++- libs/platforms/rosa/terraform/terraform.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/platforms/rosa/hypershift/hypershift.py b/libs/platforms/rosa/hypershift/hypershift.py index b21b26f..1fdc090 100644 --- a/libs/platforms/rosa/hypershift/hypershift.py +++ b/libs/platforms/rosa/hypershift/hypershift.py @@ -494,6 +494,7 @@ def create_cluster(self, platform, cluster_name): else: cluster_info['status'] = "installed" cluster_end_time = int(datetime.datetime.utcnow().timestamp()) + index_time = datetime.datetime.utcnow().isoformat() # Getting againg metadata to update the cluster status cluster_info["metadata"] = self.get_metadata(cluster_name) cluster_info["install_duration"] = cluster_end_time - cluster_start_time @@ -544,7 +545,7 @@ def create_cluster(self, platform, cluster_name): self.logging.error(err) self.logging.error(f"Failed to write metadata_install.json file located at {cluster_info['path']}") if self.es is not None: - cluster_info["timestamp"] = datetime.datetime.utcnow().isoformat() + cluster_info["timestamp"] = index_time self.es.index_metadata(cluster_info) self.logging.info("Indexing Management cluster stats") os.environ["START_TIME"] = f"{cluster_start_time_on_mc}" # excludes pre-flight durations diff --git a/libs/platforms/rosa/terraform/terraform.py b/libs/platforms/rosa/terraform/terraform.py index 6332316..eb0331b 100644 --- a/libs/platforms/rosa/terraform/terraform.py +++ b/libs/platforms/rosa/terraform/terraform.py @@ -169,6 +169,7 @@ def create_cluster(self, platform, cluster_name): return 1 else: cluster_end_time = int(datetime.datetime.utcnow().timestamp()) + index_time = datetime.datetime.utcnow().isoformat() break cluster_info['status'] = "installed" @@ -202,7 +203,7 @@ def create_cluster(self, platform, cluster_name): self.logging.error(err) self.logging.error(f"Failed to write metadata_install.json file located at {cluster_info['path']}") if self.es is not None: - cluster_info["timestamp"] = datetime.datetime.utcnow().isoformat() + cluster_info["timestamp"] = index_time self.es.index_metadata(cluster_info) def _wait_for_workers(self, kubeconfig, worker_nodes, wait_time, cluster_name, machinepool_name):