Skip to content

Commit a73eb0b

Browse files
authored
[ch] log_capture_count (#5733)
Small differences with original that I think are just due to _event_time -> created_at
1 parent 3ad02e6 commit a73eb0b

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed
Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
-- !!! Query is not converted to CH syntax yet. Delete this line when it gets converted
1+
with jobs as (
2+
select
3+
j.torchci_classification.line as line,
4+
j.torchci_classification.captures as captures,
5+
j.run_id
6+
from
7+
default.workflow_job j final
8+
where
9+
j.id in (
10+
select id from materialized_views.workflow_job_by_created_at
11+
where created_at >= {startTime: DateTime64(3)} and created_at < {stopTime: DateTime64(3)}
12+
)
13+
and j.conclusion in ('cancelled', 'failure', 'time_out')
14+
)
215
select
316
COUNT(*) as num,
4-
ARBITRARY(j.torchci_classification.line) as example,
5-
j.torchci_classification.captures as captures,
6-
ARRAY_JOIN(j.torchci_classification.captures, '%') as search_string
17+
any(line) as example,
18+
captures as captures
719
from
8-
workflow_job j
9-
join workflow_run w on w.id = j.run_id
20+
jobs j
21+
join default.workflow_run w final on w.id = j.run_id
1022
where
11-
j._event_time >= PARSE_TIMESTAMP_ISO8601(:startTime)
12-
and j._event_time < PARSE_TIMESTAMP_ISO8601(:stopTime)
23+
w.id in (select run_id from jobs)
1324
and w.head_branch = 'main'
14-
and w.head_repository.full_name = 'pytorch/pytorch'
15-
and j.conclusion in ('cancelled', 'failure', 'time_out')
25+
and w.head_repository.'full_name' = 'pytorch/pytorch'
1626
AND w.event != 'workflow_run'
1727
AND w.event != 'repository_dispatch'
1828
group by
19-
j.torchci_classification.captures
29+
captures
2030
order by
2131
COUNT(*) desc

torchci/pages/metrics.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ export default function Page() {
10801080
title={"Failed Jobs Log Classifications"}
10811081
queryName={"log_captures_count"}
10821082
queryCollection={"metrics"}
1083-
queryParams={[...timeParams]}
1083+
queryParams={useClickHouse ? timeParamsClickHouse : [...timeParams]}
10841084
columns={[
10851085
{ field: "num", headerName: "Count", flex: 1 },
10861086
{ field: "example", headerName: "Example", flex: 4 },
@@ -1100,8 +1100,9 @@ export default function Page() {
11001100
]}
11011101
dataGridProps={{
11021102
getRowId: (el: any) =>
1103-
el.search_string ? el.search_string : "null",
1103+
el.captures ? JSON.stringify(el.captures) : "null",
11041104
}}
1105+
useClickHouse={useClickHouse}
11051106
/>
11061107
</Grid>
11071108
<Grid item xs={6} height={ROW_HEIGHT}>

0 commit comments

Comments
 (0)