The duration of successful builds.
This metric is calculated by getting the duration of successful cicd_pipelines, such as Jenkins builds, GitLab pipelines and GitHub workflow runs in the given data range.
Data Sources Required
This metric relies on Jenkins builds, GitLab pipelines or GitHub workflow runs.
Data Transformation Required
N/A
SQL Queries
The following SQL shows how to find the mean duration of successful CI builds finished in the given time range.
SELECT avg(duration_sec/60) as duration_in_minutes FROM cicd_pipelines WHERE result = 'SUCCESS' and $__timeFilter(finished_date) ORDER BY 1
If you want to measure the mean duration of builds
in the screenshot below, please run the following SQL in Grafana.
WITH _builds as( SELECT DATE_ADD(date(finished_date), INTERVAL -DAYOFMONTH(date(finished_date))+1 DAY) as time, avg(duration_sec) as mean_duration_sec FROM cicd_pipelines WHERE $__timeFilter(finished_date) and id like "%jenkins%" and name in ($job_id) -- the following condition will remove the month with incomplete data and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH) GROUP BY 1 ) SELECT date_format(time,'%M %Y') as month, mean_duration_sec/60 as mean_duration_minutes FROM _builds ORDER BY time