[libcxx] [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:43:17 PDT 2025


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

>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 1/4] [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)
 
 

>From c2548d22621742abe094cc9d64317195068bf652 Mon Sep 17 00:00:00 2001
From: Caroline Tice <cmtice at google.com>
Date: Mon, 25 Aug 2025 14:20:58 -0700
Subject: [PATCH 2/4] Add doc for poking PR testing.

---
 libcxx/docs/CarolinesDoc.txt | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 libcxx/docs/CarolinesDoc.txt

diff --git a/libcxx/docs/CarolinesDoc.txt b/libcxx/docs/CarolinesDoc.txt
new file mode 100644
index 0000000000000..59160eeda15c1
--- /dev/null
+++ b/libcxx/docs/CarolinesDoc.txt
@@ -0,0 +1,2 @@
+This is just  a test document, for poking the PR and causing it to run the
+libc++ premerge tests.

>From 6b3a875225fce1393b09950c54d7427d7837667a Mon Sep 17 00:00:00 2001
From: Caroline Tice <cmtice at google.com>
Date: Mon, 25 Aug 2025 14:38:39 -0700
Subject: [PATCH 3/4] Remove debugging code.

---
 .ci/metrics/metrics.py       | 25 +++++++------------------
 libcxx/docs/CarolinesDoc.txt |  2 --
 2 files changed, 7 insertions(+), 20 deletions(-)
 delete mode 100644 libcxx/docs/CarolinesDoc.txt

diff --git a/.ci/metrics/metrics.py b/.ci/metrics/metrics.py
index b77d79d012271..0e5d30fe143c2 100644
--- a/.ci/metrics/metrics.py
+++ b/.ci/metrics/metrics.py
@@ -346,7 +346,9 @@ def github_get_metrics(
                 elif job.name.find("stage3") != -1:
                     job_key = "stage3"
                 if job_key:
-                    ag_name = name_prefix + "_" + GITHUB_JOB_TO_TRACK[name_prefix][job_key]
+                    ag_name = (
+                        name_prefix + "_" + GITHUB_JOB_TO_TRACK[name_prefix][job_key]
+                    )
 
 
             if task.status != "completed":
@@ -502,23 +504,11 @@ 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'
@@ -535,10 +525,9 @@ 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)
 
 
diff --git a/libcxx/docs/CarolinesDoc.txt b/libcxx/docs/CarolinesDoc.txt
deleted file mode 100644
index 59160eeda15c1..0000000000000
--- a/libcxx/docs/CarolinesDoc.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-This is just  a test document, for poking the PR and causing it to run the
-libc++ premerge tests.

>From d838db73927b74e01235c437a5478b733710783f Mon Sep 17 00:00:00 2001
From: Caroline Tice <cmtice at google.com>
Date: Mon, 25 Aug 2025 14:42:40 -0700
Subject: [PATCH 4/4] Fix python indentation error.

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

diff --git a/.ci/metrics/metrics.py b/.ci/metrics/metrics.py
index 0e5d30fe143c2..a8c91487417b4 100644
--- a/.ci/metrics/metrics.py
+++ b/.ci/metrics/metrics.py
@@ -507,8 +507,8 @@ def upload_metrics(workflow_metrics, metrics_userid, api_key):
 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'



More information about the llvm-commits mailing list