[llvm] [llvmn][CI] Update libc++ metrics to count running & queued aggregates. (PR #155298)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 25 14:18:40 PDT 2025


https://github.com/cmtice created https://github.com/llvm/llvm-project/pull/155298

None

>From 304d01a657e3bb5ac615aebd3b781ece2ada2f26 Mon Sep 17 00:00:00 2001
From: Caroline Tice <cmtice at google.com>
Date: Mon, 25 Aug 2025 14:16:38 -0700
Subject: [PATCH] [llvmn][CI] Update libc++ metrics to count running & queued
 aggregates.

---
 .ci/metrics/metrics.py | 38 ++++++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/.ci/metrics/metrics.py b/.ci/metrics/metrics.py
index 0896b193b6b03..b77d79d012271 100644
--- a/.ci/metrics/metrics.py
+++ b/.ci/metrics/metrics.py
@@ -336,11 +336,28 @@ def github_get_metrics(
                 name_suffix = GITHUB_JOB_TO_TRACK[name_prefix][job.name]
             metric_name = name_prefix + "_" + name_suffix
 
+            ag_metric_name = None
+            if libcxx_testing:
+                job_key = None
+                if job.name.find("stage1") != -1:
+                    job_key = "stage1"
+                elif job.name.find("stage2") != -1:
+                    job_key = "stage2"
+                elif job.name.find("stage3") != -1:
+                    job_key = "stage3"
+                if job_key:
+                    ag_name = name_prefix + "_" + GITHUB_JOB_TO_TRACK[name_prefix][job_key]
+
+
             if task.status != "completed":
                 if job.status == "queued":
                     queued_count[metric_name] += 1
+                    if libcxx_testing:
+                        queued_count[ag_name] += 1
                 elif job.status == "in_progress":
                     running_count[metric_name] += 1
+                    if libcxx_testing:
+                        running_count[ag_name] += 1
                 continue
 
             job_result = int(job.conclusion == "success" or job.conclusion == "skipped")
@@ -485,11 +502,23 @@ def upload_metrics(workflow_metrics, metrics_userid, api_key):
         logging.info(f"Failed to submit data to Grafana: {response.status_code}")
 
 
+def dump_local(gh_metrics):
+    full_datetime = datetime.datetime.now()
+    dt_str = full_datetime.strftime("%Y-%m-%d_%H:%M:%S")
+    dir_name = "/usr/local/google/home/cmtice/libcxx-metrics-work"
+    filename = "gh_metrics." + dt_str + ".log"
+    full_filename = os.path.join(dir_name, filename)
+
+    with  open(full_filename, 'w') as fp:
+        for entry in gh_metrics:
+            fp.write("  %s\n" % repr(entry))
+
+
 def main():
     # Authenticate with Github
     github_auth = Auth.Token(os.environ["GITHUB_TOKEN"])
-    grafana_api_key = os.environ["GRAFANA_API_KEY"]
-    grafana_metrics_userid = os.environ["GRAFANA_METRICS_USERID"]
+#    grafana_api_key = os.environ["GRAFANA_API_KEY"]
+#    grafana_metrics_userid = os.environ["GRAFANA_METRICS_USERID"]
 
     # The last workflow this script processed.
     # Because the Github queries are broken, we'll simply log a 'processed'
@@ -506,9 +535,10 @@ def main():
             github_repo, gh_last_workflows_seen_as_completed
         )
 
-        upload_metrics(gh_metrics, grafana_metrics_userid, grafana_api_key)
-        logging.info(f"Uploaded {len(gh_metrics)} metrics")
+#        upload_metrics(gh_metrics, grafana_metrics_userid, grafana_api_key)
+#        logging.info(f"Uploaded {len(gh_metrics)} metrics")
 
+        dump_local(gh_metrics) ## CAROLINE!!
         time.sleep(SCRAPE_INTERVAL_SECONDS)
 
 



More information about the llvm-commits mailing list