forked from kubernetes/test-infra
-
Notifications
You must be signed in to change notification settings - Fork 1
/
presubmit-health.yaml
74 lines (73 loc) · 1.92 KB
/
presubmit-health.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
metric: presubmit-health
description: Calculate daily health metrics for presubmits
query: |
#standardSQL
SELECT
UNIX_SECONDS(day) day,
job,
ROUND(prs_failed/prs * 100, 1) pr_failure_perc,
prs,
prs_failed,
total_runs,
ROUND(total_elapsed / total_runs / 60, 1) avg_run_time_minutes,
IF(total_passes>0,
ROUND(total_pass_elapsed / total_passes / 60, 1),
0) avg_pass_time_minutes
FROM (
SELECT
day,
job,
COUNT(job) prs,
SUM(IF(passes<runs,
1,
0)) prs_failed,
SUM(passes_elapsed) total_pass_elapsed,
SUM(passes) total_passes,
SUM(total_elapsed) total_elapsed,
SUM(runs) total_runs
FROM (
SELECT
day,
job,
pr,
COUNTIF(result='SUCCESS') passes,
COUNT(result) runs,
SUM(elapsed) total_elapsed,
SUM(IF(result='SUCCESS',elapsed,0)) passes_elapsed
FROM (
SELECT
TIMESTAMP_TRUNC(started, day) day,
path,
job,
result,
elapsed,
REGEXP_EXTRACT(path, "/(\\d+)/") pr
FROM
`k8s-gubernator.build.all`
WHERE
REGEXP_CONTAINS(job, '^pr:')
AND started > TIMESTAMP_SECONDS(<LAST_DATA_TIME>)
AND started < TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), day)
AND elapsed IS NOT NULL)
GROUP BY
day,
job,
pr)
GROUP BY
day,
job)
ORDER BY
day DESC,
pr_failure_perc DESC
jqfilter: |
([(.[] | .day|tonumber)] | max) as $newestday |
[(.[] | select((.day|tonumber)==$newestday) | {
day: (.day|tonumber|todateiso8601[:10]),
job: .job,
pr_failure_perc: (.pr_failure_perc|tonumber),
prs: (.prs|tonumber),
prs_failed: (.prs_failed|tonumber),
total_runs: (.total_runs|tonumber),
avg_run_time_minutes: (.avg_run_time_minutes|tonumber),
avg_pass_time_minutes: (.avg_pass_time_minutes|tonumber),
})]