You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2023/01/30 11:28:51 UTC

[incubator-devlake] branch release-v0.15 updated: fix: fetch project name from the projects and add distinct for some d… (#4267)

This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch release-v0.15
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v0.15 by this push:
     new f0e2ad1f4 fix: fetch project name from the projects and add distinct for some d… (#4267)
f0e2ad1f4 is described below

commit f0e2ad1f4c8ccc65990a7164caa5920b4f71ca5d
Author: abeizn <zi...@merico.dev>
AuthorDate: Mon Jan 30 19:22:45 2023 +0800

    fix: fetch project name from the projects and add distinct for some d… (#4267)
    
    * fix: fetch project name from the projects and add distinct for some duplicate data
    
    * fix: fetch project name from the projects and add distinct for some duplicate data
---
 grafana/dashboards/DORA.json                       |  8 ++---
 grafana/dashboards/EngineeringOverview.json        |  4 +--
 .../EngineeringThroughputAndCycleTime.json         | 41 +++-------------------
 .../EngineeringThroughputAndCycleTimeTeamView.json | 35 ++----------------
 4 files changed, 13 insertions(+), 75 deletions(-)

diff --git a/grafana/dashboards/DORA.json b/grafana/dashboards/DORA.json
index e205d9153..412a423cb 100644
--- a/grafana/dashboards/DORA.json
+++ b/grafana/dashboards/DORA.json
@@ -143,7 +143,7 @@
           "metricColumn": "none",
           "queryType": "randomWalk",
           "rawQuery": true,
-          "rawSql": "-- Metric 1: Deployment Frequency\nwith last_few_calendar_months as(\n-- get the last few months within the selected time period in the top-right corner\n\tSELECT CAST((SYSDATE()-INTERVAL (H+T+U) DAY) AS date) day\n\tFROM ( SELECT 0 H\n\t\t\tUNION ALL SELECT 100 UNION ALL SELECT 200 UNION ALL SELECT 300\n\t\t) H CROSS JOIN ( SELECT 0 T\n\t\t\tUNION ALL SELECT  10 UNION ALL SELECT  20 UNION ALL SELECT  30\n\t\t\tUNION ALL SELECT  40 UNION ALL SELECT  50 UNION ALL SELE [...]
+          "rawSql": "-- Metric 1: Deployment Frequency\nwith last_few_calendar_months as(\n-- get the last few months within the selected time period in the top-right corner\n\tSELECT CAST((SYSDATE()-INTERVAL (H+T+U) DAY) AS date) day\n\tFROM ( SELECT 0 H\n\t\t\tUNION ALL SELECT 100 UNION ALL SELECT 200 UNION ALL SELECT 300\n\t\t) H CROSS JOIN ( SELECT 0 T\n\t\t\tUNION ALL SELECT  10 UNION ALL SELECT  20 UNION ALL SELECT  30\n\t\t\tUNION ALL SELECT  40 UNION ALL SELECT  50 UNION ALL SELE [...]
           "refId": "A",
           "select": [
             [
@@ -242,7 +242,7 @@
           "metricColumn": "none",
           "queryType": "randomWalk",
           "rawQuery": true,
-          "rawSql": "-- Metric 1: Deployment Frequency\nwith last_few_calendar_months as(\n-- get the last few months within the selected time period in the top-right corner\n\tSELECT CAST((SYSDATE()-INTERVAL (H+T+U) DAY) AS date) day\n\tFROM ( SELECT 0 H\n\t\t\tUNION ALL SELECT 100 UNION ALL SELECT 200 UNION ALL SELECT 300\n\t\t) H CROSS JOIN ( SELECT 0 T\n\t\t\tUNION ALL SELECT  10 UNION ALL SELECT  20 UNION ALL SELECT  30\n\t\t\tUNION ALL SELECT  40 UNION ALL SELECT  50 UNION ALL SELE [...]
+          "rawSql": "-- Metric 1: Deployment Frequency\nwith last_few_calendar_months as(\n-- get the last few months within the selected time period in the top-right corner\n\tSELECT CAST((SYSDATE()-INTERVAL (H+T+U) DAY) AS date) day\n\tFROM ( SELECT 0 H\n\t\t\tUNION ALL SELECT 100 UNION ALL SELECT 200 UNION ALL SELECT 300\n\t\t) H CROSS JOIN ( SELECT 0 T\n\t\t\tUNION ALL SELECT  10 UNION ALL SELECT  20 UNION ALL SELECT  30\n\t\t\tUNION ALL SELECT  40 UNION ALL SELECT  50 UNION ALL SELE [...]
           "refId": "A",
           "select": [
             [
@@ -1003,7 +1003,7 @@
           ]
         },
         "datasource": "mysql",
-        "definition": "select distinct project_name from project_mapping",
+        "definition": "select distinct name from projects",
         "description": null,
         "error": null,
         "hide": 0,
@@ -1012,7 +1012,7 @@
         "multi": true,
         "name": "project",
         "options": [],
-        "query": "select distinct project_name from project_mapping",
+        "query": "select distinct name from projects",
         "refresh": 1,
         "regex": "",
         "skipUrlSync": false,
diff --git a/grafana/dashboards/EngineeringOverview.json b/grafana/dashboards/EngineeringOverview.json
index 1c9dedce4..99e42c149 100644
--- a/grafana/dashboards/EngineeringOverview.json
+++ b/grafana/dashboards/EngineeringOverview.json
@@ -1743,7 +1743,7 @@
           "value": "$__all"
         },
         "datasource": "mysql",
-        "definition": "select distinct project_name from project_mapping",
+        "definition": "select distinct name from projects",
         "description": null,
         "error": null,
         "hide": 0,
@@ -1752,7 +1752,7 @@
         "multi": true,
         "name": "project",
         "options": [],
-        "query": "select distinct project_name from project_mapping",
+        "query": "select distinct name from projects",
         "refresh": 1,
         "regex": "",
         "skipUrlSync": false,
diff --git a/grafana/dashboards/EngineeringThroughputAndCycleTime.json b/grafana/dashboards/EngineeringThroughputAndCycleTime.json
index fda15fbfb..511c9584a 100644
--- a/grafana/dashboards/EngineeringThroughputAndCycleTime.json
+++ b/grafana/dashboards/EngineeringThroughputAndCycleTime.json
@@ -167,7 +167,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "SELECT\n  DATE_ADD(date(pr.created_date), INTERVAL -$interval(date(pr.created_date))+1 DAY) as time,\n  count(id) as \"PR: Opened\",\n  count(distinct case when pr.merged_date is not null then id else null end) as \"PR: Merged\"\nFROM pull_requests pr\n  join project_mapping pm on pr.base_repo_id = pm.row_id\nWHERE\n  $__timeFilter(pr.created_date)\n  and pm.project_name in ($project)\ngroup by 1\n",
+          "rawSql": "SELECT\n  DATE_ADD(date(pr.created_date), INTERVAL -$interval(date(pr.created_date))+1 DAY) as time,\n  count(distinct pr.id) as \"PR: Opened\",\n  count(distinct case when pr.merged_date is not null then id else null end) as \"PR: Merged\"\nFROM pull_requests pr\n  join project_mapping pm on pr.base_repo_id = pm.row_id\nWHERE\n  $__timeFilter(pr.created_date)\n  and pm.project_name in ($project)\ngroup by 1\n",
           "refId": "A",
           "select": [
             [
@@ -305,7 +305,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "SELECT\n  DATE_ADD(date(i.created_date), INTERVAL -$interval(date(i.created_date))+1 DAY) as time,\n  count(i.id) as 'Issues Opened',\n  count(case when i.status = 'DONE' then i.id else null end) as 'Issues Completed'\nFROM issues i\n\tjoin board_issues bi on i.id = bi.issue_id\n\tjoin boards b on bi.board_id = b.id\n\tjoin project_mapping pm on b.id = pm.row_id\nWHERE\n  $__timeFilter(i.created_date)\n  and pm.project_name in ($project)\ngroup by 1",
+          "rawSql": "SELECT\n  DATE_ADD(date(i.created_date), INTERVAL -$interval(date(i.created_date))+1 DAY) as time,\n  count(distinct i.id) as 'Issues Opened',\n  count(distinct case when i.status = 'DONE' then i.id else null end) as 'Issues Completed'\nFROM issues i\n\tjoin board_issues bi on i.id = bi.issue_id\n\tjoin boards b on bi.board_id = b.id\n\tjoin project_mapping pm on b.id = pm.row_id\nWHERE\n  $__timeFilter(i.created_date)\n  and pm.project_name in ($project)\ngroup by 1",
           "refId": "A",
           "select": [
             [
@@ -519,7 +519,7 @@
           "hide": false,
           "metricColumn": "none",
           "rawQuery": true,
-          "rawSql": "SELECT\n  DATE_ADD(date(pr.created_date), INTERVAL -$interval(date(pr.created_date))+1 DAY) as time,\n  count(distinct prc.id)/count(pr.id) as \"PR Review Depth\"\nFROM \n  pull_requests pr\n  left join pull_request_comments prc on pr.id = prc.pull_request_id\n  join project_mapping pm on pr.base_repo_id = pm.row_id\nWHERE\n  $__timeFilter(pr.created_date)\n  and pm.project_name in ($project)\n  and pr.merged_date is not null\ngroup by 1\n",
+          "rawSql": "SELECT\n  DATE_ADD(date(pr.created_date), INTERVAL -$interval(date(pr.created_date))+1 DAY) as time,\n  count(distinct prc.id)/count(distinct pr.id) as \"PR Review Depth\"\nFROM \n  pull_requests pr\n  left join pull_request_comments prc on pr.id = prc.pull_request_id\n  join project_mapping pm on pr.base_repo_id = pm.row_id\nWHERE\n  $__timeFilter(pr.created_date)\n  and pm.project_name in ($project)\n  and pr.merged_date is not null\ngroup by 1\n",
           "refId": "A",
           "select": [
             [
@@ -1564,7 +1564,7 @@
           ]
         },
         "datasource": "mysql",
-        "definition": "select distinct project_name from project_mapping",
+        "definition": "select distinct name from projects",
         "description": null,
         "error": null,
         "hide": 0,
@@ -1573,7 +1573,7 @@
         "multi": true,
         "name": "project",
         "options": [],
-        "query": "select distinct project_name from project_mapping",
+        "query": "select distinct name from projects",
         "refresh": 1,
         "regex": "",
         "skipUrlSync": false,
@@ -1638,37 +1638,6 @@
         "queryValue": "",
         "skipUrlSync": false,
         "type": "custom"
-      },
-      {
-        "allValue": null,
-        "current": {
-          "selected": false,
-          "text": "Last Comment Date",
-          "value": "last_comment_date"
-        },
-        "description": "",
-        "error": null,
-        "hide": 0,
-        "includeAll": false,
-        "label": "Review End Date",
-        "multi": false,
-        "name": "review_end_date",
-        "options": [
-          {
-            "selected": false,
-            "text": "PR Merged Date",
-            "value": "pr_merged_date"
-          },
-          {
-            "selected": true,
-            "text": "Last Comment Date",
-            "value": "last_comment_date"
-          }
-        ],
-        "query": "PR Merged Date : pr_merged_date, Last Comment Date : last_comment_date",
-        "queryValue": "",
-        "skipUrlSync": false,
-        "type": "custom"
       }
     ]
   },
diff --git a/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json b/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json
index a1bfff206..8986097c1 100644
--- a/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json
+++ b/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json
@@ -2643,7 +2643,7 @@
           "value": "$__all"
         },
         "datasource": "mysql",
-        "definition": "select distinct project_name from project_mapping",
+        "definition": "select distinct name from projects",
         "description": null,
         "error": null,
         "hide": 0,
@@ -2652,7 +2652,7 @@
         "multi": true,
         "name": "project",
         "options": [],
-        "query": "select distinct project_name from project_mapping",
+        "query": "select distinct name from projects",
         "refresh": 1,
         "regex": "",
         "skipUrlSync": false,
@@ -2767,37 +2767,6 @@
         "queryValue": "",
         "skipUrlSync": false,
         "type": "custom"
-      },
-      {
-        "allValue": null,
-        "current": {
-          "selected": false,
-          "text": "Last Comment Date",
-          "value": "last_comment_date"
-        },
-        "description": "",
-        "error": null,
-        "hide": 0,
-        "includeAll": false,
-        "label": "Review End Date",
-        "multi": false,
-        "name": "review_end_date",
-        "options": [
-          {
-            "selected": false,
-            "text": "PR Merged Date",
-            "value": "pr_merged_date"
-          },
-          {
-            "selected": true,
-            "text": "Last Comment Date",
-            "value": "last_comment_date"
-          }
-        ],
-        "query": "PR Merged Date : pr_merged_date, Last Comment Date : last_comment_date",
-        "queryValue": "",
-        "skipUrlSync": false,
-        "type": "custom"
       }
     ]
   },