The number of pull requests (eg. GitHub PRs, Bitbucket PRs, GitLab MRs) created.
This metric is calculated by counting the number of PRs in the given data range.
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 PRs created in specific repositories and given time range.
select count(*) as pull_request_count from pull_requests pr where -- $__timeFilter will take Grafana's time range $__timeFilter(created_date) -- please replace the repo ids with your own, or create a '$repo_id' variable in Grafana and base_repo_id in ('repo_1', 'repo_2') -- remove PRs submitted by bots, comment it out if you don't need it and author_name not rlike '^robot-|-robot$|\\[bot\\]|-bot$|-ci$|-testing$'
If you want to measure the monthly trend of PR count
in the screenshot below, please run the following SQL in Grafana.
WITH _prs as( SELECT DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time, count(*) as pr_count FROM pull_requests WHERE -- please replace the repo ids with your own, or create a '$repo_id' variable in Grafana base_repo_id in ('repo_1', 'repo_2') and $__timeFilter(created_date) -- the following condition will remove the month with incomplete data and created_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH) -- remove PRs submitted by bots, comment it out if you don't need it and author_name not rlike '^robot-|-robot$|\\[bot\\]|-bot$|-ci$|-testing$' GROUP BY 1 ) SELECT date_format(time,'%M %Y') as month, pr_count as "Pull Request Count" FROM _prs ORDER BY time