Skip to content

Commit

Permalink
fix: rename pr size to pr merged size (#7823)
Browse files Browse the repository at this point in the history
* fix: rename pr size to pr merged size

* fix: dashboards version
  • Loading branch information
abeizn authored and action_bot committed Aug 2, 2024
1 parent ebddfe3 commit c74283e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 51 deletions.
25 changes: 9 additions & 16 deletions grafana/dashboards/EngineeringThroughputAndCycleTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 27,
"links": [],
"liveNow": false,
"panels": [
Expand Down Expand Up @@ -786,7 +785,7 @@
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "PR Size",
"axisLabel": "PR Merged Size",
"axisPlacement": "auto",
"barAlignment": 1,
"drawStyle": "line",
Expand Down Expand Up @@ -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": [
[
Expand Down Expand Up @@ -910,7 +909,7 @@
]
}
],
"title": "PR Size",
"title": "PR Merged Size",
"type": "timeseries"
},
{
Expand Down Expand Up @@ -1104,8 +1103,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
}
Expand Down Expand Up @@ -1241,8 +1239,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
}
Expand Down Expand Up @@ -1378,8 +1375,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
}
Expand Down Expand Up @@ -1546,8 +1542,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
}
Expand Down Expand Up @@ -1714,8 +1709,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
}
Expand Down Expand Up @@ -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": ""
}
26 changes: 10 additions & 16 deletions grafana/dashboards/EngineeringThroughputAndCycleTimeTeamView.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 1,
"id": 9,
"links": [],
"liveNow": false,
"panels": [
Expand Down Expand Up @@ -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"
},
{
Expand Down Expand Up @@ -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": [
[
Expand Down Expand Up @@ -1814,7 +1814,7 @@
]
}
],
"title": " Average PR Size by Team",
"title": " Average PR Merged Size by Team",
"type": "timeseries"
},
{
Expand Down Expand Up @@ -2425,8 +2425,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
}
Expand Down Expand Up @@ -2593,8 +2592,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
}
Expand Down Expand Up @@ -2761,8 +2759,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
}
Expand Down Expand Up @@ -2929,8 +2926,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
}
Expand Down Expand Up @@ -3123,8 +3119,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
}
Expand Down Expand Up @@ -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": ""
}
46 changes: 27 additions & 19 deletions grafana/dashboards/WorkLogs.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 40,
"id": 20,
"links": [],
"liveNow": false,
"panels": [
Expand All @@ -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": {
Expand Down Expand Up @@ -209,7 +209,7 @@
"showHeader": true,
"sortBy": []
},
"pluginVersion": "10.4.1",
"pluginVersion": "11.0.0",
"targets": [
{
"datasource": "mysql",
Expand Down Expand Up @@ -352,7 +352,7 @@
"showHeader": true,
"sortBy": []
},
"pluginVersion": "10.4.1",
"pluginVersion": "11.0.0",
"targets": [
{
"datasource": "mysql",
Expand Down Expand Up @@ -780,7 +780,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.1",
"pluginVersion": "11.0.0",
"targets": [
{
"datasource": "mysql",
Expand Down Expand Up @@ -853,7 +853,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.1",
"pluginVersion": "11.0.0",
"targets": [
{
"datasource": "mysql",
Expand Down Expand Up @@ -926,7 +926,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.1",
"pluginVersion": "11.0.0",
"targets": [
{
"datasource": "mysql",
Expand Down Expand Up @@ -999,7 +999,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.1",
"pluginVersion": "11.0.0",
"targets": [
{
"datasource": "mysql",
Expand Down Expand Up @@ -1194,7 +1194,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
}
]
},
Expand All @@ -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": [
Expand All @@ -1250,7 +1252,7 @@
}
}
],
"title": "Average PR size",
"title": "Average PR merged size",
"type": "stat"
},
{
Expand All @@ -1265,7 +1267,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
}
]
},
Expand All @@ -1290,10 +1293,11 @@
"fields": "",
"values": true
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.2.6",
"pluginVersion": "11.0.0",
"targets": [
{
"datasource": "mysql",
Expand Down Expand Up @@ -1337,7 +1341,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
}
]
},
Expand All @@ -1362,10 +1367,11 @@
"fields": "",
"values": true
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.2.6",
"pluginVersion": "11.0.0",
"targets": [
{
"datasource": "mysql",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -1461,6 +1469,6 @@
"timezone": "",
"title": "Work Logs",
"uid": "d449042e-22f0-4357-b8b7-22083f47618d",
"version": 6,
"version": 1,
"weekStart": ""
}

0 comments on commit c74283e

Please sign in to comment.