You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "Startrekzky (via GitHub)" <gi...@apache.org> on 2023/05/10 09:36:38 UTC

[GitHub] [incubator-devlake] Startrekzky commented on a diff in pull request #5144: feat: updated pr-status-realated metrics

Startrekzky commented on code in PR #5144:
URL: https://github.com/apache/incubator-devlake/pull/5144#discussion_r1189628713


##########
grafana/dashboards/GitHub.json:
##########
@@ -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": "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 = 'CLOSED' 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",

Review Comment:
   Should it be:
   count(distinct case when  status = 'MERGED' then id else null end) as \"PR: Closed and merged\"



##########
grafana/dashboards/Gitlab.json:
##########
@@ -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 = 'CLOSED' 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",

Review Comment:
   Should it be:
   count(distinct case when status = 'CLOSED' then id else null end)/count(distinct case when status in ('CLOSED', 'MERGED')  then id else null end)



##########
grafana/dashboards/ContributorExperience.json:
##########
@@ -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": "select\n  100 * 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', '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)",

Review Comment:
   Should it be:
   "rawSql": "select\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)



##########
grafana/dashboards/Gitlab.json:
##########
@@ -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 = 'CLOSED'\ngroup by 1\norder by 2 desc\nlimit 20\n",

Review Comment:
   Should it be:
   base_repo_id in ($repo_id)\n\tand pr.status = 'MERGED'



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org