Skip to content

Commit 450117d

Browse files
committed
Address reviewer comments,
1 parent 61ac179 commit 450117d

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

.ci/metrics/metrics.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,21 @@ class AggregateMetric:
9696
aggregate_queue_time: int
9797
aggregate_run_time: int
9898
aggregate_status: int
99+
completed_at_ns: int
99100
workflow_id: int
100101

101102

102103
def create_and_append_libcxx_aggregates(
103104
workflow_metrics: list[JobMetrics]) -> list[JobMetrics,AggregateMetric]:
104-
"""
105-
Find libc++ JobMetric entries and create aggregate metrics for them.
105+
"""Find libc++ JobMetric entries and create aggregate metrics for them.
106+
107+
Args:
108+
workflow_metrics: A list of JobMetrics entries collected so far.
109+
110+
Returns:
111+
Returns a list of JobMetrics and AggregateMetric entries. It should
112+
be the input list with the newly create AggregateMetric entries
113+
appended to it.
106114
107115
Sort the libc++ JobMetric entries by workflow id, and for each workflow
108116
id group them by stages. Create an aggreate metric for each stage for each
@@ -194,19 +202,25 @@ def create_and_append_libcxx_aggregates(
194202
workflow_metrics.append(
195203
AggregateMetric(
196204
ag_name, ag_queue_time, ag_run_time, ag_status,
197-
ag_workflow_id
205+
last_complete, ag_workflow_id
198206
)
199207
)
200208
return
201209

202210
def clean_up_libcxx_job_name(old_name: str) -> str:
203-
"""
204-
Convert libcxx job names to generically legal strings.
211+
"""Convert libcxx job names to generically legal strings.
212+
213+
Args:
214+
old_name: A string with the full name of the libc++ test that was run.
215+
216+
Returns:
217+
Returns the input string with characters that might not be acceptable
218+
in some indentifier strings replaced with safer characters.
205219
206220
Take a name like 'stage1 (generic-cxx03, clang-22, clang++-22)'
207221
and convert it to 'stage1_generic_cxx03__clang_22__clangxx_22'.
208222
(Remove parentheses; replace commas, hyphens and spaces with
209-
underscores; replace '+' with 'x'.
223+
underscores; replace '+' with 'x'.)
210224
"""
211225
# Names should have exactly one set of parentheses, so break on that. If
212226
# they don't have any parentheses, then don't update them at all.
@@ -285,8 +299,7 @@ def github_get_metrics(
285299
break
286300

287301
# This workflow is not interesting to us.
288-
if (task.name not in GITHUB_WORKFLOW_TO_TRACK
289-
and task.name != "Build and Test libc++"):
302+
if (task.name not in GITHUB_WORKFLOW_TO_TRACK):
290303
continue
291304

292305
libcxx_testing = False
@@ -442,6 +455,11 @@ def upload_metrics(workflow_metrics, metrics_userid, api_key):
442455
metrics_batch.append(
443456
f"{name} queue_time={workflow_metric.queue_time},run_time={workflow_metric.run_time},status={workflow_metric.status} {workflow_metric.completed_at_ns}"
444457
)
458+
elif isinstance(workflow_metric, AggregateMetric):
459+
name = workflow_metric.aggregate_name.lower().replace(" ", "_")
460+
metrics_batch.append(
461+
f"{name} queue_time={workflow_metric.aggregate_queue_time},run_time={workflow_metric.aggregate_run_time},status={workflow_metric.aggregate_status} {workflow_metric.completed_at_ns}"
462+
)
445463
else:
446464
raise ValueError(
447465
f"Unsupported object type {type(workflow_metric)}: {str(workflow_metric)}"

0 commit comments

Comments
 (0)