1
0
Fork 0

added more queries

This commit is contained in:
Christian Kühnel 2021-06-23 09:37:17 +02:00 committed by Mikhail Goncharov
parent 4ae48e963d
commit 54fa9b1556
3 changed files with 33 additions and 2 deletions

View file

@ -0,0 +1,17 @@
/* list builders with success rate <70% over the last 7 days
these are probably worth investigating
*/
Select *,
format('https://lab.llvm.org/buildbot/#/builders/%s', builder_id) as link
FROM (
SELECT
builder_id,
count(*) as num_builds,
(100.0*count(CASE WHEN buildbot_overview.result='build successful' THEN 1 END)/count(*)) as success_prct
FROM buildbot_overview
WHERE completed_at > current_date - interval '7' day
GROUP BY builder_id
) as builder_success
WHERE success_prct < 70

View file

@ -0,0 +1,9 @@
/* list last 100 git commits with number of builds and success rate */
SELECT git_commits.hash as revision,
count(*) as num_builds,
(100.0*count(CASE WHEN buildbot_overview.result='build successful' THEN 1 END)/count(*)) as success_prct
FROM buildbot_overview, git_commits
WHERE buildbot_overview.revision = git_commits.hash
GROUP BY git_commits.hash
ORDER BY git_commits.commit_time DesC
LIMIT 100

View file

@ -1,4 +1,7 @@
/* Aggregated build information from multiple tables. */ /* Aggregated build information from multiple tables
also extracts additional columns from json data to make access easier. */
CREATE OR REPLACE VIEW buildbot_overview AS CREATE OR REPLACE VIEW buildbot_overview AS
SELECT SELECT
buildbot_buildsets.data -> 'sourcestamps' -> 0 ->> 'revision' AS revision, buildbot_buildsets.data -> 'sourcestamps' -> 0 ->> 'revision' AS revision,
@ -6,7 +9,9 @@ SELECT
buildbot_builds.builder_id, buildbot_builds.builder_id,
buildbot_builds.build_number, buildbot_builds.build_number,
buildbot_builds.build_data ->>'state_string' AS result, buildbot_builds.build_data ->>'state_string' AS result,
format('https://lab.llvm.org/buildbot/#/builders/%s/builds/%s', buildbot_builds.builder_id, buildbot_builds.build_number) as link format('https://lab.llvm.org/buildbot/#/builders/%s/builds/%s', buildbot_builds.builder_id, buildbot_builds.build_number) as link,
to_timestamp(CAST(build_data ->> 'complete_at' as int))::date as completed_at,
to_timestamp(CAST(build_data ->> 'started_at' as int))::date as started_at
FROM buildbot_buildsets, buildbot_buildrequests, buildbot_builds FROM buildbot_buildsets, buildbot_buildrequests, buildbot_builds
WHERE buildbot_buildrequests.buildset_id = buildbot_buildsets.buildset_id AND WHERE buildbot_buildrequests.buildset_id = buildbot_buildsets.buildset_id AND
CAST(buildbot_builds.build_data ->> 'buildrequestid' AS int) = buildbot_buildrequests.buildrequest_id; CAST(buildbot_builds.build_data ->> 'buildrequestid' AS int) = buildbot_buildrequests.buildrequest_id;