Skip to content

Commit 2fce6c2

Browse files
committed
fix: remove tool layer query from demo dashboard
1 parent 4a5f2a7 commit 2fce6c2

File tree

2 files changed

+8
-68
lines changed

2 files changed

+8
-68
lines changed

grafana/dashboards/DemoCommitCountByAuthor.json

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
"editable": true,
1616
"gnetId": null,
1717
"graphTooltip": 0,
18-
"id": 65,
19-
"iteration": 1637051268125,
18+
"id": 71,
2019
"links": [
2120
{
2221
"asDropdown": false,
@@ -188,7 +187,7 @@
188187
"group": [],
189188
"metricColumn": "none",
190189
"rawQuery": true,
191-
"rawSql": "with commit_data as(\n SELECT\n DATE_ADD(date(authored_date), INTERVAL -DAY(date(authored_date))+1 DAY) as time,\n gc.author_name,\n count(*) as commit_count\n FROM github_commits gc\n join github_repositories gr on gc.repository_id = gr.github_id\n WHERE\n message not like '%Merge pull request%'\n and $__timeFilter(authored_date)\n and gc.repository_id = $repo_id\n group by 2,1\n order by 2,1\n),\n\nthis_month as(\n select \n\t\tDATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY) as this_month\n),\n\nlast_month as(\n\tselect \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -1 MONTH) as last_month\n),\n\nthe_month_before_last as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -2 MONTH) as the_month_before_last\n),\n\nthis_month_record as(\n\tSELECT\n\t\tauthor_name,\n\t\tcommit_count as this_month_count,\n\t\ttime as this_month\n\tfrom commit_data\n\tWHERE \n\t\ttime in (SELECT this_month from this_month)\n),\n\nlast_month_record as(\n\tSELECT\n\t\tauthor_name,\n\t\tcommit_count as last_month_count,\n\t\ttime as last_month\n\tfrom commit_data\n\tWHERE \n\t\ttime in (SELECT last_month from last_month)\n),\nthe_month_before_last_record as(\n\tSELECT\n\t\tauthor_name,\n\t\tcommit_count as the_month_before_last_count,\n\t\ttime as the_month_before_last\n\tfrom commit_data\n\tWHERE \n\t\ttime in (SELECT the_month_before_last from the_month_before_last)\n)\n\nSELECT\n COALESCE(NULLIF(tmr.author_name,''), NULLIF(lmr.author_name,''), tmblr.author_name) AS 'Author Name',\n\tCOALESCE(tmblr.the_month_before_last_count,0) AS \"The Month before Last\",\n\tCOALESCE(lmr.last_month_count,0) AS \"Last Month\",\n\tCOALESCE(tmr.this_month_count,0) AS \"This Month\",\n\tcase \n\t when lmr.last_month_count is null or tmr.this_month_count is null then '-'\n\t else concat(FORMAT(100 * (tmr.this_month_count - lmr.last_month_count)/lmr.last_month_count,1),'%') end as \"Changes in last 2 month\"\nFROM this_month_record tmr \nright join last_month_record lmr on tmr.author_name = lmr.author_name \nright join the_month_before_last_record tmblr on lmr.author_name = tmblr.author_name",
190+
"rawSql": "with commit_data as(\n SELECT\n DATE_ADD(date(authored_date), INTERVAL -DAY(date(authored_date))+1 DAY) as time,\n c.author_name,\n count(*) as commit_count\n FROM commits c\n WHERE\n c.message not like '%Merge%'\n and $__timeFilter(authored_date)\n group by 2,1\n order by 2,1\n),\n\nthis_month as(\n select \n\t\tDATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY) as this_month\n),\n\nlast_month as(\n\tselect \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -1 MONTH) as last_month\n),\n\nthe_month_before_last as(\n\tSELECT \n\t\tDATE_ADD(DATE_ADD(date(CURDATE()), INTERVAL -DAY(date(CURDATE()))+1 DAY), INTERVAL -2 MONTH) as the_month_before_last\n),\n\nthis_month_record as(\n\tSELECT\n\t\tauthor_name,\n\t\tcommit_count as this_month_count,\n\t\ttime as this_month\n\tfrom commit_data\n\tWHERE \n\t\ttime in (SELECT this_month from this_month)\n),\n\nlast_month_record as(\n\tSELECT\n\t\tauthor_name,\n\t\tcommit_count as last_month_count,\n\t\ttime as last_month\n\tfrom commit_data\n\tWHERE \n\t\ttime in (SELECT last_month from last_month)\n),\nthe_month_before_last_record as(\n\tSELECT\n\t\tauthor_name,\n\t\tcommit_count as the_month_before_last_count,\n\t\ttime as the_month_before_last\n\tfrom commit_data\n\tWHERE \n\t\ttime in (SELECT the_month_before_last from the_month_before_last)\n)\n\nSELECT\n COALESCE(NULLIF(tmr.author_name,''), NULLIF(lmr.author_name,''), tmblr.author_name) AS 'Author Name',\n\tCOALESCE(tmblr.the_month_before_last_count,0) AS \"The Month before Last\",\n\tCOALESCE(lmr.last_month_count,0) AS \"Last Month\",\n\tCOALESCE(tmr.this_month_count,0) AS \"This Month\",\n\tcase \n\t when lmr.last_month_count is null or tmr.this_month_count is null then '-'\n\t else concat(FORMAT(100 * (tmr.this_month_count - lmr.last_month_count)/lmr.last_month_count,1),'%') end as \"Changes in last 2 month\"\nFROM this_month_record tmr \nright join last_month_record lmr on tmr.author_name = lmr.author_name \nright join the_month_before_last_record tmblr on lmr.author_name = tmblr.author_name",
192191
"refId": "A",
193192
"select": [
194193
[
@@ -222,36 +221,7 @@
222221
"style": "dark",
223222
"tags": [],
224223
"templating": {
225-
"list": [
226-
{
227-
"allValue": null,
228-
"current": {
229-
"selected": true,
230-
"text": [
231-
"All"
232-
],
233-
"value": [
234-
"$__all"
235-
]
236-
},
237-
"datasource": "mysql",
238-
"definition": "select distinct concat(name, ': ', github_id) from github_repositories",
239-
"description": null,
240-
"error": null,
241-
"hide": 0,
242-
"includeAll": true,
243-
"label": "Choose Repo",
244-
"multi": true,
245-
"name": "repo_id",
246-
"options": [],
247-
"query": "select distinct concat(name, ': ', github_id) from github_repositories",
248-
"refresh": 1,
249-
"regex": "/^(?<text>[^:]+): (?<value>\\d+)$/",
250-
"skipUrlSync": false,
251-
"sort": 0,
252-
"type": "query"
253-
}
254-
]
224+
"list": []
255225
},
256226
"time": {
257227
"from": "now-6M",
@@ -261,5 +231,5 @@
261231
"timezone": "",
262232
"title": "Demo-Commit Count by Author",
263233
"uid": "F0iYknc7z",
264-
"version": 6
234+
"version": 2
265235
}

grafana/dashboards/DemoIsThisMonthMoreProductiveThanLast.json

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
"editable": true,
1616
"gnetId": null,
1717
"graphTooltip": 0,
18-
"id": 62,
19-
"iteration": 1637051301873,
18+
"id": 79,
2019
"links": [
2120
{
2221
"asDropdown": false,
@@ -139,7 +138,7 @@
139138
"group": [],
140139
"metricColumn": "none",
141140
"rawQuery": true,
142-
"rawSql": "with _commits as(\n SELECT\n DATE_ADD(date(authored_date), INTERVAL -DAY(date(authored_date))+1 DAY) as time,\n count(*) as commit_count\n FROM commits\n WHERE\n message not like '%Merge%'\n and $__timeFilter(authored_date)\n and repo_id = $repo_id\n group by 1\n)\n\nSELECT \n date_format(time,'%M %Y') as month,\n commit_count as \"Commit Count\"\nFROM _commits\nORDER BY time",
141+
"rawSql": "with _commits as(\n SELECT\n DATE_ADD(date(authored_date), INTERVAL -DAY(date(authored_date))+1 DAY) as time,\n count(*) as commit_count\n FROM commits\n WHERE\n message not like '%Merge%'\n and $__timeFilter(authored_date)\n group by 1\n)\n\nSELECT \n date_format(time,'%M %Y') as month,\n commit_count as \"Commit Count\"\nFROM _commits\nORDER BY time",
143142
"refId": "A",
144143
"select": [
145144
[
@@ -218,36 +217,7 @@
218217
"style": "dark",
219218
"tags": [],
220219
"templating": {
221-
"list": [
222-
{
223-
"allValue": null,
224-
"current": {
225-
"selected": true,
226-
"text": [
227-
"All"
228-
],
229-
"value": [
230-
"$__all"
231-
]
232-
},
233-
"datasource": "mysql",
234-
"definition": "select distinct concat(name, ': ', github_id) from github_repositories",
235-
"description": null,
236-
"error": null,
237-
"hide": 0,
238-
"includeAll": true,
239-
"label": "Choose Repo",
240-
"multi": true,
241-
"name": "repo_id",
242-
"options": [],
243-
"query": "select distinct concat(name, ': ', github_id) from github_repositories",
244-
"refresh": 1,
245-
"regex": "/^(?<text>[^:]+): (?<value>\\d+)$/",
246-
"skipUrlSync": false,
247-
"sort": 0,
248-
"type": "query"
249-
}
250-
]
220+
"list": []
251221
},
252222
"time": {
253223
"from": "now-6M",
@@ -257,5 +227,5 @@
257227
"timezone": "",
258228
"title": "Demo-Is this month more productive than last?",
259229
"uid": "ddREk75nk",
260-
"version": 16
230+
"version": 6
261231
}

0 commit comments

Comments
 (0)