]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
supervisor: Add instrumentation for job time
authorZack Cerza <zack@redhat.com>
Thu, 9 Mar 2023 18:38:04 +0000 (11:38 -0700)
committerZack Cerza <zack@redhat.com>
Wed, 22 Mar 2023 15:52:10 +0000 (09:52 -0600)
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/dispatcher/supervisor.py
teuthology/exporter.py

index caf0e802c8240e61ae0d3facb375386109daba66..13c43a6c09618a336bcd99800772998a1fbc2fee 100644 (file)
@@ -8,7 +8,7 @@ import requests
 from urllib.parse import urljoin
 from datetime import datetime
 
-from teuthology import kill, nuke, report, safepath
+from teuthology import exporter, kill, nuke, report, safepath
 from teuthology.config import config as teuth_config
 from teuthology.exceptions import SkipJob, MaxWhileTries
 from teuthology import setup_log_file, install_except_hook
@@ -50,12 +50,13 @@ def main(args):
             yaml.safe_dump(job_config, f, default_flow_style=False)
 
     try:
-        return run_job(
-            job_config,
-            teuth_bin_path,
-            archive_dir,
-            verbose
-        )
+        with exporter.JobTime.labels(job_config["suite"]).time():
+            return run_job(
+                job_config,
+                teuth_bin_path,
+                archive_dir,
+                verbose
+            )
     except SkipJob:
         return 0
 
index d40e55b109a7d661e749097debfac5bc93b3e41c..b3ee9dcf2fb1b8ce06cac398c3d088bab1d64dc2 100644 (file)
@@ -188,6 +188,12 @@ NodeLockingTime = Summary(
     ["machine_type", "count"],
 )
 
+JobTime = Summary(
+    "teuthology_job_duration_seconds",
+    "Time spent executing a job",
+    ["suite"],
+)
+
 
 def main(args):
     exporter = TeuthologyExporter(interval=int(args["--interval"]))