k8s.io/test-infra@v0.0.0-20240520184403-27c6b4c223d8/metrics/configs/build-stats.yaml (about)

     1  metric: build-stats
     2  description: Calculate the number of builds started and passed each day
     3  query: |
     4    #standardSQL
     5    select
     6      unix_seconds(day) day,
     7      invocations,
     8      passes,
     9      if (invocations > 0, passes / invocations, 1) rate
    10    from (
    11    SELECT
    12      timestamp_trunc(started, day) day,
    13      COUNT(started) invocations,
    14      countif(result = 'SUCCESS') passes
    15    FROM
    16      `k8s-gubernator.build.all`
    17    where
    18      started >= TIMESTAMP_SECONDS(<LAST_DATA_TIME>)
    19      and started < timestamp_trunc(current_timestamp(), day)
    20    group by day
    21    order by day
    22    )
    23    where day is not null
    24    order by day
    25  
    26  jqfilter: |
    27    ([(.[] | .day|tonumber)] | max) as $newestday |
    28    [(.[] | select((.day|tonumber)==$newestday) | {
    29      day: .day,
    30      invocations: (.invocations|tonumber),
    31      passes: (.passes|tonumber),
    32      rate: (.rate|tonumber)
    33    })]