What is this metric?
PR Cycle Time is the sum of PR Coding Time, Pickup TIme, Review Time and Deploy Time. It is the total time from the first commit to when the PR is deployed.
Why is it important?
PR Cycle Time indicates the overall velocity of the delivery progress in terms of PR.
Which dashboard(s) does it exist in?
How is it calculated?
You can define
deployment based on your actual practice. For a full list of
deployment's definitions that DevLake support, please refer to Deployment Frequency.
This metric relies on PRs/MRs collected from GitHub, GitLab, BitBucket, Gitee or other code review tools.Data Transformation Required
The following SQL shows how to find the
cycle time of a specific PR. DevLake pre-calculates the metric and stores it in table.pull_requests.
change_timespan/60 as 'PR Cycle Time(h)'
If you want to measure the monthly trend of
PR cycle time in the screenshot below, please run the following SQL in Grafana.
DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,
avg(change_timespan)/60 as 'PR Cycle Time(h)'
GROUP BY 1
ORDER BY 1
How to improve?
- Divide coding tasks into workable and manageable pieces;
- Use DevLake's dashboards to monitor your delivery progress;
- Have a habit to check for hanging PRs regularly;
- Set up alerts for your communication tools (e.g. Slack, Lark) when new PRs are issued;
- Use automated tests for the initial work;
- Reduce PR size;
- Analyze the causes for long reviews.