]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
repo_utils: Add instrumentation for bootstrap time
authorZack Cerza <zack@redhat.com>
Thu, 9 Mar 2023 19:22:53 +0000 (12:22 -0700)
committerZack Cerza <zack@redhat.com>
Wed, 22 Mar 2023 15:52:10 +0000 (09:52 -0600)
And fix a couple of linter errors.

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/exporter.py
teuthology/repo_utils.py

index 776cc873b793d402b8c25c9fda80b753b08344f0..ef1c3229dac6e8bbbc0ef2f07c0152ede5096fa9 100644 (file)
@@ -200,6 +200,11 @@ TaskTime = Summary(
     ["name", "phase"],
 )
 
+BootstrapTime = Summary(
+    "teuthology_bootstrap_duration_seconds",
+    "Time spent running teuthology's bootstrap script",
+)
+
 
 def main(args):
     exporter = TeuthologyExporter(interval=int(args["--interval"]))
index 1fe189dfbe9bc7a1e1cbdb07b6f71c43413791d9..93ee225a3319fa0d2453ab0ec2f63e73e248e00d 100644 (file)
@@ -5,6 +5,8 @@ import shutil
 import subprocess
 import time
 
+import teuthology.exporter as exporter
+
 from teuthology import misc
 from teuthology.util.flock import FileLock
 from teuthology.config import config
@@ -438,6 +440,7 @@ def fetch_teuthology(branch, commit=None, lock=True):
 
 
 def bootstrap_teuthology(dest_path):
+    with exporter.BootstrapTime.time():
         log.info("Bootstrapping %s", dest_path)
         # This magic makes the bootstrap script not attempt to clobber an
         # existing virtualenv. But the branch's bootstrap needs to actually
@@ -445,11 +448,15 @@ def bootstrap_teuthology(dest_path):
         env = os.environ.copy()
         env['NO_CLOBBER'] = '1'
         cmd = './bootstrap'
-        boot_proc = subprocess.Popen(cmd, shell=True, cwd=dest_path, env=env,
-                                     stdout=subprocess.PIPE,
-                                     stderr=subprocess.STDOUT,
-                                     universal_newlines=True)
-        out, err = boot_proc.communicate()
+        boot_proc = subprocess.Popen(
+            cmd, shell=True,
+            cwd=dest_path,
+            env=env,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.STDOUT,
+            universal_newlines=True
+        )
+        out, _ = boot_proc.communicate()
         returncode = boot_proc.wait()
         log.info("Bootstrap exited with status %s", returncode)
         if returncode != 0: