Skip to content

Commit 3ed73e8

Browse files
authored
fix: azure,bamboo,github,jira distinct primary key (#6850) (#6851)
* fix: azure,bamboo,github,jira distinct primary key
1 parent 43b1a18 commit 3ed73e8

4 files changed

Lines changed: 388 additions & 152 deletions

File tree

grafana/dashboards/AzureDevOps.json

Lines changed: 74 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"editable": true,
1919
"fiscalYearStartMonth": 0,
2020
"graphTooltip": 0,
21-
"id": 46,
21+
"id": 7,
2222
"links": [],
2323
"liveNow": false,
2424
"panels": [
@@ -43,7 +43,7 @@
4343
"content": "- Use Cases: This dashboard shows the basic Git and Code Review metrics from Azure DevOps.\n- Data Source Required: Azure DevOps",
4444
"mode": "markdown"
4545
},
46-
"pluginVersion": "9.5.2",
46+
"pluginVersion": "9.5.15",
4747
"targets": [
4848
{
4949
"datasource": {
@@ -130,16 +130,17 @@
130130
"text": {},
131131
"textMode": "auto"
132132
},
133-
"pluginVersion": "9.5.2",
133+
"pluginVersion": "9.5.15",
134134
"targets": [
135135
{
136136
"datasource": "mysql",
137+
"editorMode": "code",
137138
"format": "table",
138139
"group": [],
139140
"hide": false,
140141
"metricColumn": "none",
141142
"rawQuery": true,
142-
"rawSql": "select\n\tcount(*) as pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\t\n\n",
143+
"rawSql": "select\n\tcount(distinct pr.id) as pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\t\n\n",
143144
"refId": "A",
144145
"select": [
145146
[
@@ -151,6 +152,23 @@
151152
}
152153
]
153154
],
155+
"sql": {
156+
"columns": [
157+
{
158+
"parameters": [],
159+
"type": "function"
160+
}
161+
],
162+
"groupBy": [
163+
{
164+
"property": {
165+
"type": "string"
166+
},
167+
"type": "groupBy"
168+
}
169+
],
170+
"limit": 50
171+
},
154172
"table": "ae_projects",
155173
"timeColumn": "ae_create_time",
156174
"timeColumnType": "timestamp",
@@ -253,7 +271,7 @@
253271
"hide": false,
254272
"metricColumn": "none",
255273
"rawQuery": true,
256-
"rawSql": "with _prs as(\n SELECT\n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n count(*) as pr_count\n FROM pull_requests\n WHERE\n base_repo_id in ($repo_id)\n and $__timeFilter(created_date)\n and created_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\n group by 1\n)\n\nSELECT \n date_format(time,'%M %Y') as month,\n pr_count as \"Pull Request Count\"\nFROM _prs\nORDER BY time\n",
274+
"rawSql": "with _prs as(\n SELECT\n DATE_ADD(date(created_date), INTERVAL -DAY(date(created_date))+1 DAY) as time,\n count(distinct id) as pr_count\n FROM pull_requests\n WHERE\n base_repo_id in ($repo_id)\n and $__timeFilter(created_date)\n and created_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\n group by 1\n)\n\nSELECT \n date_format(time,'%M %Y') as month,\n pr_count as \"Pull Request Count\"\nFROM _prs\nORDER BY time\n",
257275
"refId": "A",
258276
"select": [
259277
[
@@ -379,12 +397,13 @@
379397
"targets": [
380398
{
381399
"datasource": "mysql",
400+
"editorMode": "code",
382401
"format": "table",
383402
"group": [],
384403
"hide": false,
385404
"metricColumn": "none",
386405
"rawQuery": true,
387-
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n author_name,\n\tcount(*) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand pr.status = 'MERGED'\ngroup by 1\norder by 2 desc\nlimit 20\n",
406+
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n author_name,\n\tcount(distinct pr.id) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand pr.status = 'MERGED'\ngroup by 1\norder by 2 desc\nlimit 20\n",
388407
"refId": "A",
389408
"select": [
390409
[
@@ -396,6 +415,23 @@
396415
}
397416
]
398417
],
418+
"sql": {
419+
"columns": [
420+
{
421+
"parameters": [],
422+
"type": "function"
423+
}
424+
],
425+
"groupBy": [
426+
{
427+
"property": {
428+
"type": "string"
429+
},
430+
"type": "groupBy"
431+
}
432+
],
433+
"limit": 50
434+
},
399435
"table": "ae_projects",
400436
"timeColumn": "ae_create_time",
401437
"timeColumnType": "timestamp",
@@ -483,7 +519,7 @@
483519
"text": {},
484520
"textMode": "auto"
485521
},
486-
"pluginVersion": "9.5.2",
522+
"pluginVersion": "9.5.15",
487523
"targets": [
488524
{
489525
"datasource": "mysql",
@@ -674,16 +710,17 @@
674710
"text": {},
675711
"textMode": "auto"
676712
},
677-
"pluginVersion": "9.5.2",
713+
"pluginVersion": "9.5.15",
678714
"targets": [
679715
{
680716
"datasource": "mysql",
717+
"editorMode": "code",
681718
"format": "table",
682719
"group": [],
683720
"hide": false,
684721
"metricColumn": "none",
685722
"rawQuery": true,
686-
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n\tcount(*) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand pr.status = 'CLOSED'",
723+
"rawSql": "-- The PR/MR statuses are standardized to DevLake's statuses 'OPEN', 'MERGED' and 'CLOSED'. You can check out the original status from the field `original_status`\nselect\n\tcount(distinct pr.id) as merged_pull_request_count\nfrom \n\tpull_requests pr\nwhere\n $__timeFilter(created_date)\n\tand base_repo_id in ($repo_id)\n\tand pr.status = 'CLOSED'",
687724
"refId": "A",
688725
"select": [
689726
[
@@ -695,6 +732,23 @@
695732
}
696733
]
697734
],
735+
"sql": {
736+
"columns": [
737+
{
738+
"parameters": [],
739+
"type": "function"
740+
}
741+
],
742+
"groupBy": [
743+
{
744+
"property": {
745+
"type": "string"
746+
},
747+
"type": "groupBy"
748+
}
749+
],
750+
"limit": 50
751+
},
698752
"table": "ae_projects",
699753
"timeColumn": "ae_create_time",
700754
"timeColumnType": "timestamp",
@@ -869,7 +923,7 @@
869923
"text": {},
870924
"textMode": "auto"
871925
},
872-
"pluginVersion": "9.5.2",
926+
"pluginVersion": "9.5.15",
873927
"targets": [
874928
{
875929
"datasource": "mysql",
@@ -1039,7 +1093,7 @@
10391093
"content": "<br/>\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).",
10401094
"mode": "markdown"
10411095
},
1042-
"pluginVersion": "9.5.2",
1096+
"pluginVersion": "9.5.15",
10431097
"targets": [
10441098
{
10451099
"datasource": {
@@ -1105,7 +1159,7 @@
11051159
"text": {},
11061160
"textMode": "auto"
11071161
},
1108-
"pluginVersion": "9.5.2",
1162+
"pluginVersion": "9.5.15",
11091163
"targets": [
11101164
{
11111165
"datasource": "mysql",
@@ -1114,7 +1168,7 @@
11141168
"group": [],
11151169
"metricColumn": "none",
11161170
"rawQuery": true,
1117-
"rawSql": "SELECT\n count(*)\nFROM \n cicd_pipelines\nWHERE\n $__timeFilter(finished_date)\n and result = 'SUCCESS'\n and id like \"%azure%\"\n and cicd_scope_id in ($repo_id)\n -- the following condition will remove the month with incomplete data\n and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)",
1171+
"rawSql": "SELECT\n count(distinct id)\nFROM \n cicd_pipelines\nWHERE\n $__timeFilter(finished_date)\n and result = 'SUCCESS'\n and id like \"%azure%\"\n and cicd_scope_id in ($repo_id)\n -- the following condition will remove the month with incomplete data\n and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)",
11181172
"refId": "A",
11191173
"select": [
11201174
[
@@ -1201,7 +1255,7 @@
12011255
"text": {},
12021256
"textMode": "auto"
12031257
},
1204-
"pluginVersion": "9.5.2",
1258+
"pluginVersion": "9.5.15",
12051259
"targets": [
12061260
{
12071261
"datasource": "mysql",
@@ -1210,7 +1264,7 @@
12101264
"group": [],
12111265
"metricColumn": "none",
12121266
"rawQuery": true,
1213-
"rawSql": "SELECT\n 1.0 * count(case when result = 'SUCCESS' then 1 else null end)/count(*)\nFROM cicd_pipelines\nWHERE\n $__timeFilter(finished_date)\n and id like \"%azure%\"\n and cicd_scope_id in ($repo_id)\n -- the following condition will remove the month with incomplete data\n and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)",
1267+
"rawSql": "SELECT\n 1.0 * count(case when result = 'SUCCESS' then id else null end)/count(distinct id)\nFROM cicd_pipelines\nWHERE\n $__timeFilter(finished_date)\n and id like \"%azure%\"\n and cicd_scope_id in ($repo_id)\n -- the following condition will remove the month with incomplete data\n and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)",
12141268
"refId": "A",
12151269
"select": [
12161270
[
@@ -1391,7 +1445,7 @@
13911445
"group": [],
13921446
"metricColumn": "none",
13931447
"rawQuery": true,
1394-
"rawSql": "SELECT\n result,\n count(*) as build_count\nFROM cicd_pipelines\nWHERE\n $__timeFilter(finished_date)\n and id like \"%azure%\"\n and cicd_scope_id in ($repo_id)\n -- the following condition will remove the month with incomplete data\n and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\nGROUP BY 1\nORDER BY 2 desc",
1448+
"rawSql": "SELECT\n result,\n count(distinct id) as build_count\nFROM cicd_pipelines\nWHERE\n $__timeFilter(finished_date)\n and id like \"%azure%\"\n and cicd_scope_id in ($repo_id)\n -- the following condition will remove the month with incomplete data\n and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\nGROUP BY 1\nORDER BY 2 desc",
13951449
"refId": "A",
13961450
"select": [
13971451
[
@@ -1476,7 +1530,7 @@
14761530
"text": {},
14771531
"textMode": "auto"
14781532
},
1479-
"pluginVersion": "9.5.2",
1533+
"pluginVersion": "9.5.15",
14801534
"targets": [
14811535
{
14821536
"datasource": "mysql",
@@ -1616,7 +1670,7 @@
16161670
"hide": false,
16171671
"metricColumn": "none",
16181672
"rawQuery": true,
1619-
"rawSql": "WITH _builds as(\n SELECT\n DATE_ADD(date(finished_date), INTERVAL -DAYOFMONTH(date(finished_date))+1 DAY) as time,\n count(*) as build_count\n FROM cicd_pipelines\n WHERE\n $__timeFilter(finished_date)\n and result = 'SUCCESS'\n and id like \"%azure%\"\n and cicd_scope_id in ($repo_id)\n -- the following condition will remove the month with incomplete data\n and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\n GROUP BY 1\n)\n\nSELECT \n date_format(time,'%M %Y') as month,\n build_count as \"Pipeline runs Count\"\nFROM _builds\nORDER BY time\n",
1673+
"rawSql": "WITH _builds as(\n SELECT\n DATE_ADD(date(finished_date), INTERVAL -DAYOFMONTH(date(finished_date))+1 DAY) as time,\n count(distinct id) as build_count\n FROM cicd_pipelines\n WHERE\n $__timeFilter(finished_date)\n and result = 'SUCCESS'\n and id like \"%azure%\"\n and cicd_scope_id in ($repo_id)\n -- the following condition will remove the month with incomplete data\n and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\n GROUP BY 1\n)\n\nSELECT \n date_format(time,'%M %Y') as month,\n build_count as \"Pipeline runs Count\"\nFROM _builds\nORDER BY time\n",
16201674
"refId": "A",
16211675
"select": [
16221676
[
@@ -1766,7 +1820,7 @@
17661820
"group": [],
17671821
"metricColumn": "none",
17681822
"rawQuery": true,
1769-
"rawSql": "WITH _build_success_rate as(\r\n SELECT\r\n DATE_ADD(date(finished_date), INTERVAL -DAYOFMONTH(date(finished_date))+1 DAY) as time,\r\n result\r\n FROM\r\n cicd_pipelines\r\n WHERE\r\n $__timeFilter(finished_date)\r\n and id like \"%azure%\"\r\n and cicd_scope_id in ($repo_id)\r\n -- the following condition will remove the month with incomplete data\r\n and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\r\n)\r\n\r\nSELECT \r\n date_format(time,'%M %Y') as month,\r\n 1.0 * sum(case when result = 'SUCCESS' then 1 else 0 end)/ count(*) as \"Pipeline runs Success Rate\"\r\nFROM _build_success_rate\r\nGROUP BY time\r\nORDER BY time",
1823+
"rawSql": "WITH _build_success_rate as(\r\n SELECT\r\n DATE_ADD(date(finished_date), INTERVAL -DAYOFMONTH(date(finished_date))+1 DAY) as time,\r\n result,\r\n id\r\n FROM\r\n cicd_pipelines\r\n WHERE\r\n $__timeFilter(finished_date)\r\n and id like \"%azure%\"\r\n and cicd_scope_id in ($repo_id)\r\n -- the following condition will remove the month with incomplete data\r\n and finished_date >= DATE_ADD(DATE_ADD($__timeFrom(), INTERVAL -DAY($__timeFrom())+1 DAY), INTERVAL +1 MONTH)\r\n GROUP BY \r\n time, result, id\r\n)\r\n\r\nSELECT \r\n date_format(time,'%M %Y') as month,\r\n 1.0 * sum(case when result = 'SUCCESS' then 1 else 0 end)/ count(*) as \"Pipeline runs Success Rate\"\r\nFROM _build_success_rate\r\nGROUP BY time\r\nORDER BY time",
17701824
"refId": "A",
17711825
"select": [
17721826
[
@@ -2002,6 +2056,6 @@
20022056
"timezone": "",
20032057
"title": "Azure DevOps",
20042058
"uid": "ba7e3a95-80ed-4067-a54b-2a82758eb3dd",
2005-
"version": 4,
2059+
"version": 3,
20062060
"weekStart": ""
20072061
}

0 commit comments

Comments
 (0)