The time it takes to complete a code review of a PR before it gets merged.
Code review should be conducted almost in real-time and usually take less than two days. Abnormally long PR Review Time may indicate one or more of the following problems:
This metric is the time frame between when the first comment is added to a PR, to when the PR is merged.
Data Sources Required
This metric relies on PRs/MRs collected from GitHub, GitLab, BitBucket, Gitee or other code review tools.
Data Transformation Required
N/A
SQL Queries
The following SQL shows how to find the review time
of a specific PR. DevLake pre-calculates the metric and stores it in table.project_pr_metrics.
SELECT pr_review_time/60 as 'PR Review Time(h)' FROM project_pr_metrics
If you want to measure the monthly trend of PR review time
in the screenshot below, please run the following SQL in Grafana.
SELECT DATE_ADD(date(pr.created_date), INTERVAL -DAY(date(pr.created_date))+1 DAY) as time, avg(ppm.pr_review_time)/60 as 'PR Review Time(h)' FROM pull_requests pr JOIN project_pr_metrics ppm ON pr.id = ppm.id GROUP BY 1 ORDER BY 1