From 07355a141bb96bde76bc6c8f80dbcb9cb22ff537 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 9 Mar 2023 12:40:15 -0700 Subject: [PATCH] supervisor: Add instrumentation for reimaging time Signed-off-by: Zack Cerza --- teuthology/dispatcher/supervisor.py | 12 +++++++++++- teuthology/exporter.py | 8 +++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/teuthology/dispatcher/supervisor.py b/teuthology/dispatcher/supervisor.py index 92443fe61..780f7a45e 100644 --- a/teuthology/dispatcher/supervisor.py +++ b/teuthology/dispatcher/supervisor.py @@ -50,7 +50,17 @@ def main(args): # reimage target machines before running the job if 'targets' in job_config: - reimage(job_config) + node_count = len(job_config["targets"]) + # If a job (e.g. from the nop suite) doesn't need nodes, avoid + # submitting a zero here. + if node_count: + with exporter.NodeReimagingTime.labels( + job_config["machine_type"], + node_count + ).time(): + reimage(job_config) + else: + reimage(job_config) with open(config_file_path, 'w') as f: yaml.safe_dump(job_config, f, default_flow_style=False) diff --git a/teuthology/exporter.py b/teuthology/exporter.py index ef1c3229d..af5126c9b 100644 --- a/teuthology/exporter.py +++ b/teuthology/exporter.py @@ -184,7 +184,13 @@ class JobResults(TeuthologyMetric): NodeLockingTime = Summary( "teuthology_node_locking_duration_seconds", - "Time spent waiting to lock a node", + "Time spent waiting to lock nodes", + ["machine_type", "count"], +) + +NodeReimagingTime = Summary( + "teuthology_node_reimaging_duration_seconds", + "Time spent reimaging nodes", ["machine_type", "count"], ) -- 2.47.3