From 6d6b4a8ded2e218632f92ebe98db13d9bfd07c03 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 9 Mar 2023 11:38:04 -0700 Subject: [PATCH] supervisor: Add instrumentation for job time Signed-off-by: Zack Cerza --- teuthology/dispatcher/supervisor.py | 15 ++++++++------- teuthology/exporter.py | 6 ++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/teuthology/dispatcher/supervisor.py b/teuthology/dispatcher/supervisor.py index caf0e802c8..13c43a6c09 100644 --- a/teuthology/dispatcher/supervisor.py +++ b/teuthology/dispatcher/supervisor.py @@ -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 diff --git a/teuthology/exporter.py b/teuthology/exporter.py index d40e55b109..b3ee9dcf2f 100644 --- a/teuthology/exporter.py +++ b/teuthology/exporter.py @@ -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"])) -- 2.39.5