From c74283e644ea994b3958d84da8fd26ddfa5139ef Mon Sep 17 00:00:00 2001 From: abeizn Date: Fri, 2 Aug 2024 18:43:13 +0800 Subject: [PATCH] fix: rename pr size to pr merged size (#7823) * fix: rename pr size to pr merged size * fix: dashboards version --- .../EngineeringThroughputAndCycleTime.json | 25 ++++------ ...neeringThroughputAndCycleTimeTeamView.json | 26 ++++------- grafana/dashboards/WorkLogs.json | 46 +++++++++++-------- 3 files changed, 46 insertions(+), 51 deletions(-) diff --git a/grafana/dashboards/EngineeringThroughputAndCycleTime.json b/grafana/dashboards/EngineeringThroughputAndCycleTime.json index 535e5d1fc8e..3dde5180e44 100644 --- a/grafana/dashboards/EngineeringThroughputAndCycleTime.json +++ b/grafana/dashboards/EngineeringThroughputAndCycleTime.json @@ -18,7 +18,6 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 27, "links": [], "liveNow": false, "panels": [ @@ -786,7 +785,7 @@ "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", - "axisLabel": "PR Size", + "axisLabel": "PR Merged Size", "axisPlacement": "auto", "barAlignment": 1, "drawStyle": "line", @@ -869,7 +868,7 @@ "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "with _pr_commits_data as(\n SELECT\n DATE_ADD(date(pr.created_date), INTERVAL -$interval(date(pr.created_date))+1 DAY) as time,\n pr.id as pr_id,\n pr.merge_commit_sha,\n sum(c.additions)+sum(c.deletions) as loc\n FROM \n pull_requests pr\n left join commits c on pr.merge_commit_sha = c.sha\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \n WHERE\n $__timeFilter(pr.created_date)\n and pm.project_name in (${project})\n and pr.status = 'MERGED'\n group by 1,2,3\n)\n\nSELECT \n time,\n sum(loc)/count(distinct pr_id) as 'PR Size'\nFROM _pr_commits_data\nGROUP BY 1", + "rawSql": "with _pr_commits_data as(\n SELECT\n DATE_ADD(date(pr.created_date), INTERVAL -$interval(date(pr.created_date))+1 DAY) as time,\n pr.id as pr_id,\n pr.merge_commit_sha,\n sum(c.additions)+sum(c.deletions) as loc\n FROM \n pull_requests pr\n left join commits c on pr.merge_commit_sha = c.sha\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \n WHERE\n $__timeFilter(pr.created_date)\n and pm.project_name in (${project})\n and pr.status = 'MERGED'\n group by 1,2,3\n)\n\nSELECT \n time,\n sum(loc)/count(distinct pr_id) as 'PR Merged Size'\nFROM _pr_commits_data\nGROUP BY 1", "refId": "A", "select": [ [ @@ -910,7 +909,7 @@ ] } ], - "title": "PR Size", + "title": "PR Merged Size", "type": "timeseries" }, { @@ -1104,8 +1103,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1241,8 +1239,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1378,8 +1375,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1546,8 +1542,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1714,8 +1709,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1961,11 +1955,10 @@ "from": "now-6M", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": {}, "timezone": "", "title": "Engineering Throughput and Cycle Time", "uid": "Jaaimc67k", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json b/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json index b112a4c20de..f73a3c77c82 100644 --- a/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json +++ b/grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json @@ -18,7 +18,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 1, + "id": 9, "links": [], "liveNow": false, "panels": [ @@ -1472,7 +1472,7 @@ "refId": "A" } ], - "title": "4. PR Review Depth and PR Size", + "title": "4. PR Review Depth and PR Merged Size", "type": "row" }, { @@ -1773,7 +1773,7 @@ "hide": false, "metricColumn": "none", "rawQuery": true, - "rawSql": "with _prs as(\n SELECT\n distinct pr.id,\n pr.url,\n pr.created_date,\n pr.merged_date,\n pr.author_id,\n pr.merge_commit_sha,\n c.additions + c.deletions as loc,\n u.id as user_id,\n u.name as user_name,\n t.id as team_id,\n t.name as team\n FROM pull_requests pr\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \n left join commits c on pr.merge_commit_sha = c.sha\n join user_accounts ua on pr.author_id = ua.account_id\n join users u on ua.user_id = u.id\n join team_users tu on u.id = tu.user_id\n join teams t on tu.team_id = t.id\n WHERE\n $__timeFilter(pr.created_date)\n and pm.project_name in (${project})\n and pr.status = 'MERGED'\n ORDER BY 1\n)\n\nselect\n DATE_ADD(date(created_date), INTERVAL -$interval(date(created_date))+1 DAY) as time,\n sum(case when team_id in (${team1}) then loc else null end)/(select count(distinct user_id) from team_users where team_id in (${team1})) as \"Team1: PR Size\",\n sum(case when team_id in (${team2}) then loc else null end)/(select count(distinct user_id) from team_users where team_id in (${team2})) as \"Team2: PR Size\",\n sum(loc)/(select count(*) FROM users) as \"Org: PR Size\"\nFROM _prs\nGROUP BY 1\nORDER BY 1", + "rawSql": "with _prs as(\n SELECT\n distinct pr.id,\n pr.url,\n pr.created_date,\n pr.merged_date,\n pr.author_id,\n pr.merge_commit_sha,\n c.additions + c.deletions as loc,\n u.id as user_id,\n u.name as user_name,\n t.id as team_id,\n t.name as team\n FROM pull_requests pr\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \n left join commits c on pr.merge_commit_sha = c.sha\n join user_accounts ua on pr.author_id = ua.account_id\n join users u on ua.user_id = u.id\n join team_users tu on u.id = tu.user_id\n join teams t on tu.team_id = t.id\n WHERE\n $__timeFilter(pr.created_date)\n and pm.project_name in (${project})\n and pr.status = 'MERGED'\n ORDER BY 1\n)\n\nselect\n DATE_ADD(date(created_date), INTERVAL -$interval(date(created_date))+1 DAY) as time,\n sum(case when team_id in (${team1}) then loc else null end)/(select count(distinct user_id) from team_users where team_id in (${team1})) as \"Team1: PR Size\",\n sum(case when team_id in (${team2}) then loc else null end)/(select count(distinct user_id) from team_users where team_id in (${team2})) as \"Team2: PR Size\",\n sum(loc)/(select count(*) FROM users) as \"Org: PR Merged Size\"\nFROM _prs\nGROUP BY 1\nORDER BY 1", "refId": "A", "select": [ [ @@ -1814,7 +1814,7 @@ ] } ], - "title": " Average PR Size by Team", + "title": " Average PR Merged Size by Team", "type": "timeseries" }, { @@ -2425,8 +2425,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -2593,8 +2592,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -2761,8 +2759,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -2929,8 +2926,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -3123,8 +3119,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -3415,11 +3410,10 @@ "from": "now-6M", "to": "now" }, - "timeRangeUpdatedDuringEditOrView": false, "timepicker": {}, "timezone": "", "title": "Engineering Throughput and Cycle Time - Team View", "uid": "nJ1ijje7k", - "version": 2, + "version": 1, "weekStart": "" } \ No newline at end of file diff --git a/grafana/dashboards/WorkLogs.json b/grafana/dashboards/WorkLogs.json index f5d06cd4065..eda0b81fe9b 100644 --- a/grafana/dashboards/WorkLogs.json +++ b/grafana/dashboards/WorkLogs.json @@ -18,7 +18,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 40, + "id": 20, "links": [], "liveNow": false, "panels": [ @@ -43,7 +43,7 @@ "content": "- Use Cases: This dashboard shows the work logs of a team or a developer\n- Data Sources Required to show all data: \n - One of the Git tools, e.g. [GitHub](https://devlake.apache.org/docs/Configuration/GitHub), [GitLab](https://devlake.apache.org/docs/Configuration/GitLab), [Bitbucket](https://devlake.apache.org/docs/Configuration/BitBucket) or [Azure DevOps](https://devlake.apache.org/docs/Configuration/AzureDevOps)\n - One of the issue tracking tools, e.g. [Jira](https://devlake.apache.org/docs/Configuration/Jira)\n - You also need to complete the [team configuration](https://devlake.apache.org/docs/Configuration/TeamConfiguration) to use this dashboard", "mode": "markdown" }, - "pluginVersion": "10.4.1", + "pluginVersion": "11.0.0", "targets": [ { "datasource": { @@ -209,7 +209,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "10.4.1", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -352,7 +352,7 @@ "showHeader": true, "sortBy": [] }, - "pluginVersion": "10.4.1", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -780,7 +780,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.1", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -853,7 +853,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.1", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -926,7 +926,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.1", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -999,7 +999,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.4.1", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -1194,7 +1194,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null } ] }, @@ -1219,17 +1220,18 @@ "fields": "", "values": true }, + "showPercentChange": false, "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.2.6", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", "editorMode": "code", "format": "table", "rawQuery": true, - "rawSql": "with _accounts as (\n select ua.account_id, ua.user_id, u.name\n from accounts a \n join user_accounts ua on a.id = ua.account_id\n join users u on ua.user_id = u.id\n where ua.user_id in ($users)\n),\n\n\n_commits as (\n SELECT distinct DATE_FORMAT(authored_date, '%d/%m/%Y') as Date, authored_date as Time, 'Finish a commit' as Activity, concat(message, ' #', sha) as Details, a.name as Name, c.additions, c.deletions, c.sha\n FROM commits c\n join _accounts a on c.author_id = a.account_id\n where $__timeFilter(authored_date)\n),\n\n_pr_commits_data as(\n SELECT\n pr.id as pr_id,\n pr.merge_commit_sha,\n sum(c.additions)+sum(c.deletions) as loc\n FROM \n pull_requests pr\n left join _commits c on pr.merge_commit_sha = c.sha\n WHERE\n $__timeFilter(pr.created_date)\n and pr.status = 'MERGED'\n group by 1,2\n)\n\nSELECT \n avg(loc) as 'PR Size'\nFROM _pr_commits_data\n", + "rawSql": "with _accounts as (\n select ua.account_id, ua.user_id, u.name\n from accounts a \n join user_accounts ua on a.id = ua.account_id\n join users u on ua.user_id = u.id\n where ua.user_id in ($users)\n),\n\n\n_commits as (\n SELECT distinct DATE_FORMAT(authored_date, '%d/%m/%Y') as Date, authored_date as Time, 'Finish a commit' as Activity, concat(message, ' #', sha) as Details, a.name as Name, c.additions, c.deletions, c.sha\n FROM commits c\n join _accounts a on c.author_id = a.account_id\n where $__timeFilter(authored_date)\n),\n\n_pr_commits_data as(\n SELECT\n pr.id as pr_id,\n pr.merge_commit_sha,\n sum(c.additions)+sum(c.deletions) as loc\n FROM \n pull_requests pr\n left join _commits c on pr.merge_commit_sha = c.sha\n WHERE\n $__timeFilter(pr.created_date)\n and pr.status = 'MERGED'\n group by 1,2\n)\n\nSELECT \n avg(loc) as 'PR Merged Size'\nFROM _pr_commits_data\n", "refId": "A", "sql": { "columns": [ @@ -1250,7 +1252,7 @@ } } ], - "title": "Average PR size", + "title": "Average PR merged size", "type": "stat" }, { @@ -1265,7 +1267,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null } ] }, @@ -1290,10 +1293,11 @@ "fields": "", "values": true }, + "showPercentChange": false, "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.2.6", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -1337,7 +1341,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null } ] }, @@ -1362,10 +1367,11 @@ "fields": "", "values": true }, + "showPercentChange": false, "textMode": "auto", "wideLayout": true }, - "pluginVersion": "10.2.6", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -1407,9 +1413,10 @@ "list": [ { "current": { + "isNone": true, "selected": false, - "text": "red", - "value": "1" + "text": "None", + "value": "" }, "datasource": "mysql", "definition": "select concat(name, '--', id) from teams", @@ -1438,6 +1445,7 @@ }, "datasource": "mysql", "definition": "select concat(users.name, '--', users.id) from users left join team_users on users.id = team_users.user_id where team_users.team_id in ($team)", + "error": {}, "hide": 0, "includeAll": true, "label": "User", @@ -1461,6 +1469,6 @@ "timezone": "", "title": "Work Logs", "uid": "d449042e-22f0-4357-b8b7-22083f47618d", - "version": 6, + "version": 1, "weekStart": "" } \ No newline at end of file