Skip to content

Commit

Permalink
fix: gitlab case inconsistency in dashboard sql (#4999)
Browse files Browse the repository at this point in the history
  • Loading branch information
abeizn committed Apr 21, 2023
1 parent 9af4124 commit 3ebafbd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions grafana/dashboards/Gitlab.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"gnetId": null,
"graphTooltip": 0,
"id": 26,
"iteration": 1682063010710,
"iteration": 1677590524546,
"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 in ('CLOSED', 'MERGED') and pr.merged_date is not null\ngroup by 1\norder by 2 desc\nlimit 20\n",
"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 in ('closed', 'merged') and pr.merged_date is not null\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 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 \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)",
"rawSql": "select\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 \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 not in ('CLOSED', 'MERGED') 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') 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": "SELECT\n DATE_ADD(date(created_date), INTERVAL -DAYOFMONTH(date(created_date))+1 DAY) as time,\n count(distinct case when status not in ('closed','merged') 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') 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",
"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 in ('CLOSED', 'MERGED') and pr.merged_date is null",
"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",
"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 in ('CLOSED', 'MERGED') and merged_date is null then id else null end)/count(distinct case when status in ('CLOSED', 'MERGED') and merged_date is not null 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": "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') and merged_date is not null 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 @@ -952,7 +952,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "select\n\tavg(TIMESTAMPDIFF(Minute,created_date,closed_date)/1440) as time_to_close\nfrom \n\tpull_requests\nwhere \n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand status in ('CLOSED', 'MERGED')\n\n\n",
"rawSql": "select\n\tavg(TIMESTAMPDIFF(Minute,created_date,closed_date)/1440) as time_to_close\nfrom \n\tpull_requests\nwhere \n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand status in ('closed', 'merged')\n\n\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -1049,7 +1049,7 @@
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "with _prs as(\n SELECT\n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n avg(TIMESTAMPDIFF(Minute,created_date,closed_date)/1440) as time_to_close\n FROM pull_requests\n WHERE\n $__timeFilter(created_date)\n and base_repo_id in ($repo_id)\n and status in ('CLOSED', 'MERGED')\n and created_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\n group by 1\n)\n\nSELECT \n date_format(time,'%M %Y') as month,\n time_to_close as \"Time to Close\"\nFROM _prs\nORDER BY time\n",
"rawSql": "with _prs as(\n SELECT\n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n avg(TIMESTAMPDIFF(Minute,created_date,closed_date)/1440) as time_to_close\n FROM pull_requests\n WHERE\n $__timeFilter(created_date)\n and base_repo_id in ($repo_id)\n and status in ('closed', 'merged')\n and created_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\n group by 1\n)\n\nSELECT \n date_format(time,'%M %Y') as month,\n time_to_close as \"Time to Close\"\nFROM _prs\nORDER BY time\n",
"refId": "A",
"select": [
[
Expand Down Expand Up @@ -1143,5 +1143,5 @@
"timezone": "",
"title": "GitLab",
"uid": "msSjEq97z",
"version": 11
"version": 10
}

0 comments on commit 3ebafbd

Please sign in to comment.