From e8d85094835a060b23a606458a7d61328a4700cd Mon Sep 17 00:00:00 2001 From: Startrekzky Date: Thu, 11 Jul 2024 13:32:59 +0800 Subject: [PATCH 1/3] fix: engineering overview dashboard --- grafana/dashboards/EngineeringOverview.json | 396 ++++++++++++-------- 1 file changed, 240 insertions(+), 156 deletions(-) diff --git a/grafana/dashboards/EngineeringOverview.json b/grafana/dashboards/EngineeringOverview.json index 3ebdfe55be1..36e4ec42685 100644 --- a/grafana/dashboards/EngineeringOverview.json +++ b/grafana/dashboards/EngineeringOverview.json @@ -18,7 +18,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 16, + "id": 24, "links": [], "liveNow": false, "panels": [ @@ -34,7 +34,6 @@ "y": 0 }, "id": 32, - "links": [], "options": { "code": { "language": "plaintext", @@ -44,7 +43,7 @@ "content": "- Use Cases: This dashboard is to overview the Git and project management metrics.\n- Data Source Required: Jira + GitHub, or Jira + GitLab.", "mode": "markdown" }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.0.0", "targets": [ { "datasource": { @@ -93,7 +92,6 @@ "y": 3 }, "id": 8, - "links": [], "options": { "colorMode": "value", "graphMode": "area", @@ -106,10 +104,12 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -160,7 +160,7 @@ ] } ], - "title": "Critical Defects Identified", + "title": "Critical Defects Identified [in the Selected Month (filtered)]", "type": "stat" }, { @@ -171,6 +171,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -215,7 +216,6 @@ "y": 3 }, "id": 22, - "links": [], "options": { "barRadius": 0, "barWidth": 0.46, @@ -234,6 +234,7 @@ "valueSize": 12 }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" }, @@ -318,7 +319,7 @@ "overrides": [] }, "gridPos": { - "h": 6, + "h": 8, "w": 6, "x": 0, "y": 11 @@ -343,10 +344,12 @@ "fields": "/^value$/", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -390,6 +393,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "Lead Time(days)", @@ -429,7 +433,7 @@ "overrides": [] }, "gridPos": { - "h": 6, + "h": 8, "w": 18, "x": 6, "y": 11 @@ -461,6 +465,7 @@ "valueSize": 12 }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" }, @@ -534,10 +539,9 @@ "h": 8, "w": 6, "x": 0, - "y": 17 + "y": 19 }, "id": 14, - "links": [], "options": { "colorMode": "value", "graphMode": "area", @@ -550,19 +554,22 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "queryType": "randomWalk", "rawQuery": true, - "rawSql": "select\n count(distinct author_name)\nfrom\n commits c\n join repo_commits rc on c.sha = rc.commit_sha\n join project_mapping pm on rc.repo_id = pm.row_id\nwhere\n date(authored_date) between\n STR_TO_DATE('$month','%Y-%m-%d') and\n STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH - INTERVAL 1 DAY and\n pm.project_name in (${project});", + "rawSql": "select\n count(distinct author_name)\nfrom\n commits c\n join repo_commits rc on c.sha = rc.commit_sha\n join project_mapping pm on rc.repo_id = pm.row_id and pm.table = 'repos' \nwhere\n date(authored_date) between STR_TO_DATE('$month','%Y-%m-%d') and STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH\n and pm.project_name in (${project})", "refId": "A", "select": [ [ @@ -574,6 +581,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "_devlake_blueprints", "timeColumn": "created_at", "timeColumnType": "timestamp", @@ -586,7 +610,7 @@ ] } ], - "title": "Number of Developers", + "title": "Number of Developers [in the Selected Month]", "type": "stat" }, { @@ -597,6 +621,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -638,10 +663,9 @@ "h": 8, "w": 18, "x": 6, - "y": 17 + "y": 19 }, "id": 24, - "links": [], "options": { "barRadius": 0, "barWidth": 0.5, @@ -660,6 +684,7 @@ "valueSize": 12 }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" }, @@ -670,12 +695,13 @@ "targets": [ { "datasource": "mysql", + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "queryType": "randomWalk", "rawQuery": true, - "rawSql": "with _developers as(\n select\n DATE_ADD(date(c.authored_date), INTERVAL -DAY(date(c.authored_date))+1 DAY) as time,\n count(distinct author_name) as developer_count\n from\n commits c\n join repo_commits rc on c.sha = rc.commit_sha\n join project_mapping pm on rc.repo_id = pm.row_id\n where\n $__timeFilter(c.authored_date)\n and c.authored_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\n and pm.project_name in (${project})\n group by time\n)\n\nselect\n date_format(time,'%M %Y') as month,\n developer_count\nfrom _developers\norder by time asc", + "rawSql": "with _developers as(\n select\n DATE_ADD(date(c.authored_date), INTERVAL -DAY(date(c.authored_date))+1 DAY) as time,\n count(distinct author_name) as developer_count\n from\n commits c\n join repo_commits rc on c.sha = rc.commit_sha\n join project_mapping pm on rc.repo_id = pm.row_id and pm.table = 'repos' \n where\n $__timeFilter(c.authored_date)\n and c.authored_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\n and pm.project_name in (${project})\n group by time\n)\n\nselect\n date_format(time,'%M %Y') as month,\n developer_count\nfrom _developers\norder by time asc", "refId": "A", "select": [ [ @@ -687,6 +713,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "_devlake_blueprints", "timeColumn": "created_at", "timeColumnType": "timestamp", @@ -736,7 +779,7 @@ "h": 8, "w": 6, "x": 0, - "y": 25 + "y": 27 }, "id": 6, "links": [ @@ -758,10 +801,12 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -771,7 +816,7 @@ "metricColumn": "none", "queryType": "randomWalk", "rawQuery": true, - "rawSql": "with _num_issues_with_sprint_updated as (\n select\n NULLIF(COUNT(DISTINCT i.id), 0) AS num_issues_with_sprint_updated\n from\n issues i\n join board_issues bi on i.id = bi.issue_id\n\t join boards b on bi.board_id = b.id\n\t join project_mapping pm on b.id = pm.row_id\n join issue_changelogs c on i.id = c.issue_id\n where\n pm.project_name in (${project}) and\n c.field_name = 'Sprint' and\n c.original_from_value != '' and\n c.original_to_value != '' and\n date(i.created_date) between\n STR_TO_DATE('$month','%Y-%m-%d') and\n STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH - INTERVAL 1 DAY\n),\n\n_total_num_issues as (\n select\n NULLIF(COUNT(distinct i.id), 0) as total_num_issues\n from\n issues i\n join board_issues bi on i.id = bi.issue_id\n\t join boards b on bi.board_id = b.id\n\t join project_mapping pm on b.id = pm.row_id\n where\n pm.project_name in (${project}) and\n date(i.created_date) between\n STR_TO_DATE('$month','%Y-%m-%d') and\n STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH - INTERVAL 1 DAY\n)\n\nselect\n now() as time,\n 100 - 100 * (select 1.0 * num_issues_with_sprint_updated from _num_issues_with_sprint_updated) / (select total_num_issues from _total_num_issues) as ratio;", + "rawSql": "with _num_issues_with_sprint_updated as (\n select\n NULLIF(COUNT(DISTINCT i.id), 0) AS num_issues_with_sprint_updated\n from\n issues i\n join board_issues bi on i.id = bi.issue_id\n\t join boards b on bi.board_id = b.id\n\t join project_mapping pm on b.id = pm.row_id\n join issue_changelogs c on i.id = c.issue_id\n where\n pm.project_name in (${project}) and\n c.field_name = 'Sprint' and\n c.original_from_value != '' and\n c.original_to_value != '' and\n date(i.created_date) between\n STR_TO_DATE('$month','%Y-%m-%d') and\n STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH\n),\n\n_total_num_issues as (\n select\n NULLIF(COUNT(distinct i.id), 0) as total_num_issues\n from\n issues i\n join board_issues bi on i.id = bi.issue_id\n\t join boards b on bi.board_id = b.id\n\t join project_mapping pm on b.id = pm.row_id\n where\n pm.project_name in (${project}) and\n date(i.created_date) between\n STR_TO_DATE('$month','%Y-%m-%d') and\n STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH\n)\n\nselect\n now() as time,\n 100 - 100 * (select 1.0 * num_issues_with_sprint_updated from _num_issues_with_sprint_updated) / (select total_num_issues from _total_num_issues) as ratio;", "refId": "A", "select": [ [ @@ -812,7 +857,7 @@ ] } ], - "title": "On-time Delivery", + "title": "On-time Delivery [in the Selected Month]", "type": "stat" }, { @@ -824,6 +869,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -837,6 +883,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 10, @@ -875,7 +922,7 @@ "h": 8, "w": 18, "x": 6, - "y": 25 + "y": 27 }, "id": 25, "links": [ @@ -893,6 +940,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" } @@ -980,7 +1028,7 @@ "h": 8, "w": 6, "x": 0, - "y": 33 + "y": 35 }, "id": 4, "links": [ @@ -1002,10 +1050,12 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -1015,7 +1065,7 @@ "metricColumn": "none", "queryType": "randomWalk", "rawQuery": true, - "rawSql": "select\n count(distinct pr.id)\nfrom\n pull_requests pr\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \nwhere\n pr.merged_date is not null \n and date(pr.merged_date) between\n STR_TO_DATE('$month','%Y-%m-%d')\n and STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH - INTERVAL 1 DAY \n and pm.project_name in (${project});", + "rawSql": "select\n count(distinct pr.id)\nfrom\n pull_requests pr\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \nwhere\n pr.merged_date is not null \n and date(pr.merged_date) between\n STR_TO_DATE('$month','%Y-%m-%d')\n and STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH\n and pm.project_name in (${project});", "refId": "A", "select": [ [ @@ -1056,7 +1106,7 @@ ] } ], - "title": "PRs merged", + "title": "PRs merged [in the Selected Month]", "type": "stat" }, { @@ -1068,6 +1118,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1109,7 +1160,7 @@ "h": 8, "w": 18, "x": 6, - "y": 33 + "y": 35 }, "id": 26, "links": [ @@ -1137,6 +1188,7 @@ "valueSize": 12 }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" }, @@ -1230,7 +1282,7 @@ "h": 8, "w": 6, "x": 0, - "y": 41 + "y": 43 }, "id": 16, "links": [ @@ -1252,10 +1304,12 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -1265,7 +1319,7 @@ "metricColumn": "none", "queryType": "randomWalk", "rawQuery": true, - "rawSql": "select \n 100*count(distinct case when pr.id in (select pull_request_id from pull_request_issues) then pr.id else null end)/count(distinct pr.id) as unlinked_pr_rate\nfrom pull_requests pr\njoin project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \nwhere pm.project_name in (${project})", + "rawSql": "select \n 100*count(distinct case when pr.id in (select pull_request_id from pull_request_issues) then pr.id else null end)/count(distinct pr.id) as unlinked_pr_rate\nfrom pull_requests pr\njoin project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \nwhere \n pm.project_name in (${project})\n and date(pr.created_date) between STR_TO_DATE('$month','%Y-%m-%d') and STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH", "refId": "A", "select": [ [ @@ -1306,7 +1360,7 @@ ] } ], - "title": "Unlinked PRs %", + "title": "Unlinked PRs % [in the Selected Month]", "type": "stat" }, { @@ -1317,6 +1371,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1330,6 +1385,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 10, @@ -1368,7 +1424,7 @@ "h": 8, "w": 18, "x": 6, - "y": 41 + "y": 43 }, "id": 28, "links": [ @@ -1386,6 +1442,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" } @@ -1473,10 +1530,9 @@ "h": 8, "w": 6, "x": 0, - "y": 49 + "y": 51 }, "id": 12, - "links": [], "options": { "colorMode": "value", "graphMode": "area", @@ -1489,10 +1545,12 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", @@ -1502,7 +1560,7 @@ "metricColumn": "none", "queryType": "randomWalk", "rawQuery": true, - "rawSql": "with _commits_groupby_name_and_date as (\n select\n author_name,\n date(authored_date) as _day,\n count(distinct c.sha)\n from\n commits c\n join repo_commits rc on c.sha = rc.commit_sha\n join project_mapping pm on rc.repo_id = pm.row_id\n where\n pm.project_name in (${project}) and\n WEEKDAY(authored_date) between 0 and 4 and\n date(authored_date) between\n STR_TO_DATE('$month','%Y-%m-%d') and\n STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH - INTERVAL 1 DAY\n group by\n author_name, date(authored_date)\n)\n\nselect 100 * count(*) / (count(distinct author_name) * count(distinct _day))\nfrom _commits_groupby_name_and_date;", + "rawSql": "with _commits_groupby_name_and_date as (\n select\n author_name,\n date(authored_date) as _day,\n count(distinct c.sha)\n from\n commits c\n join repo_commits rc on c.sha = rc.commit_sha\n join project_mapping pm on rc.repo_id = pm.row_id\n where\n pm.project_name in (${project}) and\n WEEKDAY(authored_date) between 0 and 4 and\n date(authored_date) between\n STR_TO_DATE('$month','%Y-%m-%d') and\n STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH\n group by\n author_name, date(authored_date)\n)\n\nselect 100 * count(*) / (count(distinct author_name) * count(distinct _day))\nfrom _commits_groupby_name_and_date;", "refId": "A", "select": [ [ @@ -1543,7 +1601,7 @@ ] } ], - "title": "Coding Days %", + "title": "Coding Days % [in the Selected Month]", "type": "stat" }, { @@ -1554,6 +1612,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1567,6 +1626,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 10, @@ -1605,10 +1665,9 @@ "h": 8, "w": 18, "x": 6, - "y": 49 + "y": 51 }, "id": 29, - "links": [], "options": { "legend": { "calcs": [], @@ -1617,6 +1676,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" } @@ -1706,7 +1766,7 @@ "h": 8, "w": 6, "x": 0, - "y": 57 + "y": 59 }, "id": 2, "links": [ @@ -1728,19 +1788,22 @@ "fields": "", "values": false }, + "showPercentChange": false, "text": {}, - "textMode": "auto" + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.0.0", "targets": [ { "datasource": "mysql", + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "queryType": "randomWalk", "rawQuery": true, - "rawSql": "select\n AVG(TIMESTAMPDIFF(MINUTE, pr.created_date, pr.merged_date) / 1440)\nfrom\n pull_requests pr\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \nwhere\n pm.project_name in (${project}) and\n pr.merged_date is not null\n and date(pr.created_date) between\n STR_TO_DATE('$month','%Y-%m-%d') \n and STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH - INTERVAL 1 DAY", + "rawSql": "select\n AVG(TIMESTAMPDIFF(MINUTE, pr.created_date, pr.merged_date) / 1440)\nfrom\n pull_requests pr\n join project_mapping pm on pr.base_repo_id = pm.row_id and pm.table = 'repos' \nwhere\n pm.project_name in (${project}) and\n pr.merged_date is not null\n and date(pr.created_date) between\n STR_TO_DATE('$month','%Y-%m-%d') \n and STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH", "refId": "A", "select": [ [ @@ -1752,6 +1815,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "_raw_github_api_repositories", "timeColumn": "created_at", "timeColumnType": "timestamp", @@ -1764,7 +1844,7 @@ ] } ], - "title": "Mean Time to Merge (From PR creation to merge)", + "title": "Mean Time to Merge [in the Selected Month] ", "type": "stat" }, { @@ -1776,6 +1856,7 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", @@ -1789,6 +1870,7 @@ "tooltip": false, "viz": false }, + "insertNulls": false, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 10, @@ -1828,7 +1910,7 @@ "h": 8, "w": 18, "x": 6, - "y": 57 + "y": 59 }, "id": 30, "links": [ @@ -1846,6 +1928,7 @@ "showLegend": true }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" } @@ -1912,41 +1995,13 @@ "mode": "palette-classic" }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "axisSoftMin": 0, - "fillOpacity": 68, - "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false - }, - "lineWidth": 1, - "scaleDistribution": { - "type": "linear" - }, - "thresholdsStyle": { - "mode": "off" } }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "d" + "mappings": [] }, "overrides": [] }, @@ -1954,43 +2009,47 @@ "h": 8, "w": 12, "x": 0, - "y": 65 + "y": 67 }, - "id": 20, - "links": [], + "id": 21, "options": { - "barRadius": 0, - "barWidth": 0.27, - "fullHighlight": false, - "groupWidth": 0.7, + "displayLabels": [ + "name", + "percent" + ], "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "table", + "placement": "right", + "showLegend": true, + "values": [ + "value", + "percent" + ] }, - "orientation": "auto", - "showValue": "auto", - "stacking": "none", - "text": { - "valueSize": 12 + "pieType": "pie", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" - }, - "xTickLabelRotation": 0, - "xTickLabelSpacing": 0 + } }, "targets": [ { "datasource": "mysql", + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "queryType": "randomWalk", "rawQuery": true, - "rawSql": "select\n i.priority as 'Priority',\n AVG(TIMESTAMPDIFF(MINUTE, i.created_date, NOW()) / 1440) as 'Average Age'\nfrom\n issues i\n join 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 pm.project_name in (${project}) and\n i.status = 'TODO'\n and i.type = 'BUG'\n and i.priority in (${priority})\ngroup by\n i.priority", + "rawSql": "select\n count(distinct case when i.type = 'BUG' then i.id else null end) as 'Bug',\n count(distinct case when i.type != 'BUG' and epic_key != '' then i.id else null end) as 'Strategic',\n count(distinct case when i.type != 'BUG' and epic_key = '' then i.id else null end) as 'Non-Strategic'\nfrom\n issues i\n join 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 pm.project_name in (${project}) and\n i.resolution_date is not null and\n date(resolution_date) between\n STR_TO_DATE('$month','%Y-%m-%d') and\n STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH", "refId": "A", "select": [ [ @@ -2002,6 +2061,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "_devlake_blueprints", "timeColumn": "created_at", "timeColumnType": "timestamp", @@ -2014,8 +2090,8 @@ ] } ], - "title": "Average Age of Critical Outstanding Defects by Priority", - "type": "barchart" + "title": "Work Done % [in the Selected Month]", + "type": "piechart" }, { "datasource": "mysql", @@ -2025,13 +2101,42 @@ "mode": "palette-classic" }, "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "fillOpacity": 68, + "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" } }, - "mappings": [] + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "d" }, "overrides": [] }, @@ -2039,47 +2144,43 @@ "h": 8, "w": 12, "x": 12, - "y": 65 + "y": 67 }, - "id": 21, - "links": [], + "id": 20, "options": { - "displayLabels": [ - "name", - "percent" - ], + "barRadius": 0, + "barWidth": 0.27, + "fullHighlight": false, + "groupWidth": 0.7, "legend": { - "displayMode": "table", - "placement": "right", - "showLegend": true, - "values": [ - "value", - "percent" - ] + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "pieType": "pie", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false + "orientation": "auto", + "showValue": "auto", + "stacking": "none", + "text": { + "valueSize": 12 }, "tooltip": { + "maxHeight": 600, "mode": "single", "sort": "none" - } + }, + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 }, "targets": [ { "datasource": "mysql", - "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "queryType": "randomWalk", "rawQuery": true, - "rawSql": "select\n count(distinct case when i.type = 'BUG' then i.id else null end) as 'Bug',\n count(distinct case when i.type != 'BUG' and epic_key != '' then i.id else null end) as 'Strategic',\n count(distinct case when i.type != 'BUG' and epic_key = '' then i.id else null end) as 'Non-Strategic'\nfrom\n issues i\n join 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 pm.project_name in (${project}) and\n i.resolution_date is not null and\n date(resolution_date) between\n STR_TO_DATE('$month','%Y-%m-%d') and\n STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH - INTERVAL 1 DAY", + "rawSql": "select\n i.priority as 'Priority',\n AVG(TIMESTAMPDIFF(MINUTE, i.created_date, NOW()) / 1440) as 'Average Age'\nfrom\n issues i\n join 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 pm.project_name in (${project}) and\n i.status = 'TODO'\n and i.type = 'BUG'\n and i.priority in (${priority})\ngroup by\n i.priority", "refId": "A", "select": [ [ @@ -2091,23 +2192,6 @@ } ] ], - "sql": { - "columns": [ - { - "parameters": [], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" - } - ], - "limit": 50 - }, "table": "_devlake_blueprints", "timeColumn": "created_at", "timeColumnType": "timestamp", @@ -2120,8 +2204,8 @@ ] } ], - "title": "Work Done % [Selected Month]", - "type": "piechart" + "title": "Average Age of Critical Outstanding Defects by Priority", + "type": "barchart" }, { "datasource": { @@ -2132,7 +2216,7 @@ "h": 2, "w": 24, "x": 0, - "y": 73 + "y": 75 }, "id": 34, "options": { @@ -2144,7 +2228,7 @@ "content": "
\n\nThis dashboard is created based on this [data schema](https://devlake.apache.org/docs/DataModels/DevLakeDomainLayerSchema). Want to add more metrics? Please follow the [guide](https://devlake.apache.org/docs/Configuration/Dashboards/GrafanaUserGuide).", "mode": "markdown" }, - "pluginVersion": "9.5.15", + "pluginVersion": "11.0.0", "targets": [ { "datasource": { @@ -2159,8 +2243,7 @@ } ], "refresh": "", - "schemaVersion": 38, - "style": "dark", + "schemaVersion": 39, "tags": [ "Engineering Leads Dashboard" ], @@ -2236,9 +2319,9 @@ }, { "current": { - "selected": false, - "text": "2024-01", - "value": "2024-01-01" + "selected": true, + "text": "", + "value": "" }, "datasource": "mysql", "definition": "select\n distinct(concat(date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m') , ':', date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m-%d'))) as month\nfrom\n issues i\norder by month desc", @@ -2261,10 +2344,11 @@ "from": "now-6M", "to": "now" }, + "timeRangeUpdatedDuringEditOrView": false, "timepicker": {}, "timezone": "", "title": "Engineering Overview", "uid": "ZF6abXX7z", - "version": 2, + "version": 12, "weekStart": "" } \ No newline at end of file From 81c186a963982cd5c0e2268608c5dce5386345b1 Mon Sep 17 00:00:00 2001 From: Startrekzky Date: Thu, 11 Jul 2024 13:53:52 +0800 Subject: [PATCH 2/3] fix: dynamically change the panel title value --- grafana/dashboards/EngineeringOverview.json | 118 +++++++++++++------- 1 file changed, 77 insertions(+), 41 deletions(-) diff --git a/grafana/dashboards/EngineeringOverview.json b/grafana/dashboards/EngineeringOverview.json index 36e4ec42685..5e743d9e3ee 100644 --- a/grafana/dashboards/EngineeringOverview.json +++ b/grafana/dashboards/EngineeringOverview.json @@ -160,7 +160,7 @@ ] } ], - "title": "Critical Defects Identified [in the Selected Month (filtered)]", + "title": "Critical Defects Identified [in $month]", "type": "stat" }, { @@ -222,7 +222,9 @@ "fullHighlight": false, "groupWidth": 0.7, "legend": { - "calcs": [], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -353,11 +355,12 @@ "targets": [ { "datasource": "mysql", + "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, - "rawSql": "select \r\n avg(lead_time_minutes/1440) as value\r\nfrom issues i\r\n\tjoin board_issues bi on i.id = bi.issue_id\r\n\tjoin boards b on bi.board_id = b.id\r\n\tjoin project_mapping pm on b.id = pm.row_id\r\nwhere \r\n pm.project_name in (${project}) and\r\n i.type in (${type})\r\n and i.status = 'DONE'\r\n and $__timeFilter(i.resolution_date)", + "rawSql": "select \r\n avg(lead_time_minutes/1440) as value\r\nfrom issues i\r\n\tjoin board_issues bi on i.id = bi.issue_id\r\n\tjoin boards b on bi.board_id = b.id\r\n\tjoin project_mapping pm on b.id = pm.row_id\r\nwhere \r\n pm.project_name in (${project}) and\r\n i.type in (${type})\r\n and i.status = 'DONE'\r\n and i.resolution_date between STR_TO_DATE('$month','%Y-%m-%d') and STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH;", "refId": "A", "select": [ [ @@ -369,6 +372,23 @@ } ] ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, "table": "ca_analysis", "timeColumn": "create_time", "timeColumnType": "timestamp", @@ -381,7 +401,7 @@ ] } ], - "title": "Mean Issue Lead Time in Days [Issues Resolved in Select Time Range]", + "title": "Mean Issue Lead Time in Days [Issues Resolved in $month]", "type": "stat" }, { @@ -453,7 +473,9 @@ "fullHighlight": false, "groupWidth": 0.7, "legend": { - "calcs": [], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -610,7 +632,7 @@ ] } ], - "title": "Number of Developers [in the Selected Month]", + "title": "Number of Developers [in $month]", "type": "stat" }, { @@ -672,7 +694,9 @@ "fullHighlight": false, "groupWidth": 0.7, "legend": { - "calcs": [], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -857,7 +881,7 @@ ] } ], - "title": "On-time Delivery [in the Selected Month]", + "title": "On-time Delivery [in $month]", "type": "stat" }, { @@ -934,7 +958,9 @@ ], "options": { "legend": { - "calcs": [], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -1106,7 +1132,7 @@ ] } ], - "title": "PRs merged [in the Selected Month]", + "title": "PRs merged [in $month]", "type": "stat" }, { @@ -1176,7 +1202,9 @@ "fullHighlight": false, "groupWidth": 0.7, "legend": { - "calcs": [], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -1360,7 +1388,7 @@ ] } ], - "title": "Unlinked PRs % [in the Selected Month]", + "title": "Unlinked PRs % [in $month]", "type": "stat" }, { @@ -1436,7 +1464,9 @@ ], "options": { "legend": { - "calcs": [], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -1601,7 +1631,7 @@ ] } ], - "title": "Coding Days % [in the Selected Month]", + "title": "Coding Days % [in $month]", "type": "stat" }, { @@ -1670,7 +1700,9 @@ "id": 29, "options": { "legend": { - "calcs": [], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -1844,7 +1876,7 @@ ] } ], - "title": "Mean Time to Merge [in the Selected Month] ", + "title": "Mean Time to Merge [in $month]", "type": "stat" }, { @@ -1922,7 +1954,9 @@ ], "options": { "legend": { - "calcs": [], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -2090,7 +2124,7 @@ ] } ], - "title": "Work Done % [in the Selected Month]", + "title": "Work Done % [in $month]", "type": "piechart" }, { @@ -2153,7 +2187,9 @@ "fullHighlight": false, "groupWidth": 0.7, "legend": { - "calcs": [], + "calcs": [ + "mean" + ], "displayMode": "list", "placement": "bottom", "showLegend": true @@ -2270,6 +2306,27 @@ "sort": 0, "type": "query" }, + { + "current": { + "selected": true, + "text": "", + "value": "" + }, + "datasource": "mysql", + "definition": "select\n distinct(concat(date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m') , ':', date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m-%d'))) as month\nfrom\n issues i\norder by month desc", + "hide": 0, + "includeAll": false, + "label": "Selected Month", + "multi": false, + "name": "month", + "options": [], + "query": "select\n distinct(concat(date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m') , ':', date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m-%d'))) as month\nfrom\n issues i\norder by month desc", + "refresh": 1, + "regex": "/^(?.*):(?.*)$/", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, { "current": { "selected": true, @@ -2316,27 +2373,6 @@ "skipUrlSync": false, "sort": 0, "type": "query" - }, - { - "current": { - "selected": true, - "text": "", - "value": "" - }, - "datasource": "mysql", - "definition": "select\n distinct(concat(date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m') , ':', date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m-%d'))) as month\nfrom\n issues i\norder by month desc", - "hide": 0, - "includeAll": false, - "label": "Selected Month", - "multi": false, - "name": "month", - "options": [], - "query": "select\n distinct(concat(date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m') , ':', date_format(DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY), '%Y-%m-%d'))) as month\nfrom\n issues i\norder by month desc", - "refresh": 1, - "regex": "/^(?.*):(?.*)$/", - "skipUrlSync": false, - "sort": 0, - "type": "query" } ] }, @@ -2349,6 +2385,6 @@ "timezone": "", "title": "Engineering Overview", "uid": "ZF6abXX7z", - "version": 12, + "version": 15, "weekStart": "" } \ No newline at end of file From 22d8b9e7fd114e21d44cc432b9328490d86cdb38 Mon Sep 17 00:00:00 2001 From: Startrekzky Date: Thu, 11 Jul 2024 14:01:14 +0800 Subject: [PATCH 3/3] fix: the time range filter of critical defects --- grafana/dashboards/EngineeringOverview.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grafana/dashboards/EngineeringOverview.json b/grafana/dashboards/EngineeringOverview.json index 5e743d9e3ee..768231de4a5 100644 --- a/grafana/dashboards/EngineeringOverview.json +++ b/grafana/dashboards/EngineeringOverview.json @@ -119,7 +119,7 @@ "metricColumn": "none", "queryType": "randomWalk", "rawQuery": true, - "rawSql": "select\n count(distinct i.id)\nfrom\n 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 pm.project_name in (${project}) and\n i.priority in (${priority}) and\n i.type = 'BUG' and\n date(i.created_date) between STR_TO_DATE('$month','%Y-%m-%d') and STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH - INTERVAL 1 DAY;", + "rawSql": "select\n count(distinct i.id)\nfrom\n 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 pm.project_name in (${project}) and\n i.priority in (${priority}) and\n i.type = 'BUG' and\n date(i.created_date) between STR_TO_DATE('$month','%Y-%m-%d') and STR_TO_DATE('$month','%Y-%m-%d') + INTERVAL 1 MONTH;", "refId": "A", "select": [ [