Skip to content

Commit

Permalink
feat: updated pr-status-realated metrics (#5144)
Browse files Browse the repository at this point in the history
* feat: updated pr-status-realated metrics

* feat: add pr-status-realated metrics notes

* fix: pr status dashboard bugs

* fix: pr status dashboard bugs
  • Loading branch information
abeizn committed May 10, 2023
1 parent 0469859 commit de68539
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
16 changes: 8 additions & 8 deletions grafana/dashboards/BitBucket.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 28,
"iteration": 1682062771301,
"id": 13,
"iteration": 1683688425813,
"links": [],
"panels": [
{
Expand Down Expand Up @@ -306,7 +306,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select\n author_name,\n\tcount(*) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand pr.status = 'MERGED' and pr.merged_date is not null\ngroup by 1\norder by 2 desc\nlimit 20\n",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n author_name,\n\tcount(*) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand pr.status = 'MERGED'\ngroup by 1\norder by 2 desc\nlimit 20\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -401,7 +401,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select\n count(distinct case when status='DECLINED' then id else null end)/count(distinct case when status in ('MERGED','DECLINED') then id else null end) as ratio\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n count(distinct case when status='CLOSED' then id else null end)/count(distinct case when status in ('MERGED','CLOSED') then id else null end) as ratio\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -504,7 +504,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n DATE_ADD(date(created_date), INTERVAL -DAYOFMONTH(date(created_date))+1 DAY) as time,\n count(distinct case when status = 'OPEN' then id else null end) as \"PR: Open\",\n count(distinct case when status = 'DECLINED' and merged_date is null then id else null end) as \"PR: Closed without merging\",\n count(distinct case when status = 'MERGED' and merged_date is not null then id else null end) as \"PR: Merged\"\nFROM pull_requests\nWHERE\n $__timeFilter(created_date)\n and base_repo_id in ($repo_id)\ngroup by 1\n",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nSELECT\n DATE_ADD(date(created_date), INTERVAL -DAYOFMONTH(date(created_date))+1 DAY) as time,\n count(distinct case when status = 'OPEN' then id else null end) as \"PR: Open\",\n count(distinct case when status = 'CLOSED' then id else null end) as \"PR: Closed without merging\",\n count(distinct case when status = 'MERGED' then id else null end) as \"PR: Merged\"\nFROM pull_requests\nWHERE\n $__timeFilter(created_date)\n and base_repo_id in ($repo_id)\ngroup by 1\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -586,7 +586,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select\n\tcount(*) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand pr.status = 'DECLINED'",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n\tcount(*) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand pr.status = 'CLOSED'",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -693,7 +693,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n DATE_ADD(date(created_date), INTERVAL -DAYOFMONTH(date(created_date))+1 DAY) as time,\n count(distinct case when status = 'DECLINED' then id else null end)/count(distinct case when status in ('MERGED', 'DECLINED') then id else null end) as ratio\nFROM pull_requests\nWHERE\n $__timeFilter(created_date)\n and base_repo_id in ($repo_id)\ngroup by 1\n",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nSELECT\n DATE_ADD(date(created_date), INTERVAL -DAYOFMONTH(date(created_date))+1 DAY) as time,\n count(distinct case when status = 'CLOSED' then id else null end)/count(distinct case when status in ('MERGED', 'CLOSED') then id else null end) as ratio\nFROM pull_requests\nWHERE\n $__timeFilter(created_date)\n and base_repo_id in ($repo_id)\ngroup by 1\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -966,5 +966,5 @@
"timezone": "",
"title": "BitBucket",
"uid": "4LzQHZa4k",
"version": 1
"version": 8
}
12 changes: 6 additions & 6 deletions grafana/dashboards/ContributorExperience.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 24,
"iteration": 1682062826895,
"id": 10,
"iteration": 1683690480749,
"links": [],
"panels": [
{
Expand Down Expand Up @@ -508,7 +508,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "select\n\tavg(TIMESTAMPDIFF(Minute,created_date,closed_date)/1440) as time_to_close\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('CLOSED', 'MERGED', 'DECLINED')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n\tavg(TIMESTAMPDIFF(Minute,created_date,closed_date)/1440) as time_to_close\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('CLOSED', 'MERGED')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -590,7 +590,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "select\n 100 * sum(case when TIMESTAMPDIFF(Minute, created_date, closed_date) / 1440 < $prrt_sla then 1 else null end) / count(*)\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('CLOSED', 'MERGED', 'DECLINED')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n 100 * sum(case when TIMESTAMPDIFF(Minute, created_date, closed_date) / 1440 < $prrt_sla then 1 else null end) / count(*)\nfrom \n\tpull_requests pr\nwhere \n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n\tand status in ('CLOSED', 'MERGED')\n\tand pr.base_repo_id in ($repo_id)\n\n\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -672,7 +672,7 @@
"metricColumn": "none",
"queryType": "randomWalk",
"rawQuery": true,
"rawSql": "select\n 100 * count(distinct case when status in ('CLOSED', 'MERGED', 'DECLINED') and merged_date is null then id else null end)/count(distinct case when status in ('CLOSED', 'MERGED', 'DECLINED') then id else null end) as ratio\nfrom \n\tpull_requests pr\nwhere\n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n and pr.base_repo_id in ($repo_id)",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n 100 * count(distinct case when status = 'CLOSED' then id else null end)/count(distinct case when status in ('CLOSED', 'MERGED') then id else null end) as ratio\nfrom \n\tpull_requests pr\nwhere\n date(created_date) BETWEEN\n curdate() - INTERVAL DAYOFMONTH(curdate())-1 DAY - INTERVAL 1 month and\n curdate() - INTERVAL DAYOFMONTH(curdate()) DAY\n and pr.base_repo_id in ($repo_id)",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -828,5 +828,5 @@
"timezone": "",
"title": "Contributor Experience",
"uid": "bwsP5Nz4z",
"version": 9
"version": 6
}
16 changes: 8 additions & 8 deletions grafana/dashboards/GitHub.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 3,
"iteration": 1682062979883,
"id": 26,
"iteration": 1683710488565,
"links": [],
"panels": [
{
Expand Down Expand Up @@ -1164,7 +1164,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select\n author_name,\n\tcount(*) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n and pr.status in ('CLOSED', 'MERGED', 'DECLINED') and pr.merged_date is not null\ngroup by 1\norder by 2 desc\nlimit 20\n",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n author_name,\n\tcount(*) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n and pr.status = 'MERGED'\ngroup by 1\norder by 2 desc\nlimit 20\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -1259,7 +1259,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select\n count(distinct case when status in ('CLOSED', 'MERGED') and merged_date is not null then id else null end)/count(distinct case when status in ('CLOSED', 'MERGED') then id else null end) as ratio\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n count(distinct case when status = 'MERGED' then id else null end)/count(distinct case when status in ('CLOSED', 'MERGED') then id else null end) as ratio\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -1362,7 +1362,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n DATE_ADD(date(created_date), INTERVAL -DAYOFMONTH(date(created_date))+1 DAY) as time,\n count(distinct case when status != 'CLOSED' then id else null end) as \"PR: Open\",\n count(distinct case when status in ('CLOSED', 'MERGED') and merged_date is null then id else null end) as \"PR: Closed without merging\",\n count(distinct case when status in ('CLOSED', 'MERGED') then id else null end) as \"PR: Closed and merged\"\nFROM pull_requests\nWHERE\n $__timeFilter(created_date)\n and created_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\n and base_repo_id in ($repo_id)\ngroup by 1\n",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nSELECT\n DATE_ADD(date(created_date), INTERVAL -DAYOFMONTH(date(created_date))+1 DAY) as time,\n count(distinct case when status = 'OPEN' then id else null end) as \"PR: Open\",\n count(distinct case when status = 'CLOSED' then id else null end) as \"PR: Closed without merging\",\n count(distinct case when status = 'MERGED' then id else null end) as \"PR: Closed and merged\"\nFROM pull_requests\nWHERE\n $__timeFilter(created_date)\n and created_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\n and base_repo_id in ($repo_id)\ngroup by 1\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -1444,7 +1444,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select\n\tcount(*) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand pr.status in ('CLOSED', 'MERGED') and pr.merged_date is null",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n\tcount(*) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand pr.status = 'CLOSED'",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -1549,7 +1549,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n DATE_ADD(date(created_date), INTERVAL -DAYOFMONTH(date(created_date))+1 DAY) as time,\n count(distinct case when status in ('CLOSED', 'MERGED') and merged_date is null then id else null end)/count(distinct case when status in ('CLOSED', 'MERGED') then id else null end) as ratio\nFROM pull_requests\nWHERE\n $__timeFilter(created_date)\n and base_repo_id in ($repo_id)\ngroup by 1\n",
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nSELECT\n DATE_ADD(date(created_date), INTERVAL -DAYOFMONTH(date(created_date))+1 DAY) as time,\n count(distinct case when status = 'CLOSED' then id else null end)/count(distinct case when status in ('CLOSED', 'MERGED') then id else null end) as ratio\nFROM pull_requests\nWHERE\n $__timeFilter(created_date)\n and base_repo_id in ($repo_id)\ngroup by 1\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -1999,5 +1999,5 @@
"timezone": "",
"title": "GitHub",
"uid": "KXWvOFQnz",
"version": 13
"version": 10
}
Loading

0 comments on commit de68539

Please sign in to comment.