forked from kubernetes/test-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-stats.yaml
48 lines (47 loc) · 1.12 KB
/
build-stats.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
metric: build-stats
description: Calculate the number of builds started and passed each day
query: |
#standardSQL
select
unix_seconds(day) day,
invocations,
passes,
if (invocations > 0, passes / invocations, 1) rate
from (
SELECT
timestamp_trunc(started, day) day,
COUNT(started) invocations,
countif(result = 'SUCCESS') passes
FROM
`k8s-gubernator.build.all`
where
started >= TIMESTAMP_SECONDS(<LAST_DATA_TIME>)
and started < timestamp_trunc(current_timestamp(), day)
group by day
order by day
)
where day is not null
order by day
jqfilter: |
([(.[] | .day|tonumber)] | max) as $newestday |
[(.[] | select((.day|tonumber)==$newestday) | {
day: .day,
invocations: (.invocations|tonumber),
passes: (.passes|tonumber),
rate: (.rate|tonumber)
})]
measurements:
backfill: build_stats
jq: |
[(.[] | {
measurement: "build_stats",
time: (.day|tonumber),
tags: {
day: (.day|tonumber)
},
fields: {
invocations: (.invocations|tonumber),
passes: (.passes|tonumber),
rate: (.rate|tonumber)
}
})]