Skip to content

Commit 2de13cb

Browse files
refactor(grafana): datasource configuration in dashboards json to use object format
1 parent 19d4fb9 commit 2de13cb

60 files changed

Lines changed: 6296 additions & 4232 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

grafana/dashboards/AICostEfficiency.json

Lines changed: 104 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@
3939
"type": "row"
4040
},
4141
{
42-
"datasource": "mysql",
42+
"datasource": { "type": "mysql", "uid": "mysql" },
4343
"fieldConfig": {
4444
"defaults": {
4545
"color": { "mode": "thresholds" },
4646
"mappings": [],
47-
"thresholds": { "mode": "absolute", "steps": [{ "color": "blue", "value": null }] }
47+
"thresholds": {
48+
"mode": "absolute",
49+
"steps": [{ "color": "blue", "value": null }]
50+
}
4851
},
4952
"overrides": []
5053
},
@@ -58,7 +61,7 @@
5861
},
5962
"targets": [
6063
{
61-
"datasource": "mysql",
64+
"datasource": { "type": "mysql", "uid": "mysql" },
6265
"format": "table",
6366
"rawQuery": true,
6467
"rawSql": "SELECT ROUND(SUM(credits_used)) AS 'Total Credits'\nFROM _tool_q_dev_user_report WHERE $__timeFilter(date)",
@@ -69,12 +72,15 @@
6972
"type": "stat"
7073
},
7174
{
72-
"datasource": "mysql",
75+
"datasource": { "type": "mysql", "uid": "mysql" },
7376
"fieldConfig": {
7477
"defaults": {
7578
"color": { "mode": "thresholds" },
7679
"mappings": [],
77-
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }] }
80+
"thresholds": {
81+
"mode": "absolute",
82+
"steps": [{ "color": "green", "value": null }]
83+
}
7884
},
7985
"overrides": []
8086
},
@@ -88,7 +94,7 @@
8894
},
8995
"targets": [
9096
{
91-
"datasource": "mysql",
97+
"datasource": { "type": "mysql", "uid": "mysql" },
9298
"format": "table",
9399
"rawQuery": true,
94100
"rawSql": "SELECT ROUND(SUM(r.credits_used) / NULLIF(COUNT(DISTINCT pr.id), 0), 1) AS 'Credits / PR'\nFROM _tool_q_dev_user_report r\nCROSS JOIN (\n SELECT DISTINCT id FROM pull_requests\n WHERE merged_date IS NOT NULL AND $__timeFilter(merged_date)\n) pr\nWHERE $__timeFilter(r.date)",
@@ -99,12 +105,15 @@
99105
"type": "stat"
100106
},
101107
{
102-
"datasource": "mysql",
108+
"datasource": { "type": "mysql", "uid": "mysql" },
103109
"fieldConfig": {
104110
"defaults": {
105111
"color": { "mode": "thresholds" },
106112
"mappings": [],
107-
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }] }
113+
"thresholds": {
114+
"mode": "absolute",
115+
"steps": [{ "color": "green", "value": null }]
116+
}
108117
},
109118
"overrides": []
110119
},
@@ -118,7 +127,7 @@
118127
},
119128
"targets": [
120129
{
121-
"datasource": "mysql",
130+
"datasource": { "type": "mysql", "uid": "mysql" },
122131
"format": "table",
123132
"rawQuery": true,
124133
"rawSql": "SELECT ROUND(SUM(r.credits_used) / NULLIF(COUNT(DISTINCT cdc.cicd_deployment_id), 0), 1) AS 'Credits / Deploy'\nFROM _tool_q_dev_user_report r\nCROSS JOIN (\n SELECT DISTINCT cicd_deployment_id\n FROM cicd_deployment_commits\n WHERE result = 'SUCCESS' AND environment = 'PRODUCTION'\n AND $__timeFilter(finished_date)\n) cdc\nWHERE $__timeFilter(r.date)",
@@ -129,12 +138,15 @@
129138
"type": "stat"
130139
},
131140
{
132-
"datasource": "mysql",
141+
"datasource": { "type": "mysql", "uid": "mysql" },
133142
"fieldConfig": {
134143
"defaults": {
135144
"color": { "mode": "thresholds" },
136145
"mappings": [],
137-
"thresholds": { "mode": "absolute", "steps": [{ "color": "green", "value": null }] }
146+
"thresholds": {
147+
"mode": "absolute",
148+
"steps": [{ "color": "green", "value": null }]
149+
}
138150
},
139151
"overrides": []
140152
},
@@ -148,7 +160,7 @@
148160
},
149161
"targets": [
150162
{
151-
"datasource": "mysql",
163+
"datasource": { "type": "mysql", "uid": "mysql" },
152164
"format": "table",
153165
"rawQuery": true,
154166
"rawSql": "SELECT ROUND(SUM(r.credits_used) / NULLIF(COUNT(DISTINCT i.id), 0), 1) AS 'Credits / Issue'\nFROM _tool_q_dev_user_report r\nCROSS JOIN (\n SELECT DISTINCT id FROM issues\n WHERE resolution_date IS NOT NULL AND type != 'INCIDENT'\n AND $__timeFilter(resolution_date)\n) i\nWHERE $__timeFilter(r.date)",
@@ -167,16 +179,24 @@
167179
"type": "row"
168180
},
169181
{
170-
"datasource": "mysql",
182+
"datasource": { "type": "mysql", "uid": "mysql" },
171183
"description": "Weekly cost per merged PR",
172184
"fieldConfig": {
173185
"defaults": {
174186
"color": { "mode": "palette-classic" },
175187
"custom": {
176-
"axisBorderShow": false, "axisLabel": "", "axisPlacement": "auto",
177-
"drawStyle": "line", "fillOpacity": 10, "lineInterpolation": "smooth", "lineWidth": 2,
178-
"pointSize": 5, "showPoints": "never", "spanNulls": true,
179-
"stacking": { "mode": "none" }, "thresholdsStyle": { "mode": "off" }
188+
"axisBorderShow": false,
189+
"axisLabel": "",
190+
"axisPlacement": "auto",
191+
"drawStyle": "line",
192+
"fillOpacity": 10,
193+
"lineInterpolation": "smooth",
194+
"lineWidth": 2,
195+
"pointSize": 5,
196+
"showPoints": "never",
197+
"spanNulls": true,
198+
"stacking": { "mode": "none" },
199+
"thresholdsStyle": { "mode": "off" }
180200
},
181201
"unit": "short"
182202
},
@@ -185,12 +205,17 @@
185205
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 },
186206
"id": 11,
187207
"options": {
188-
"legend": { "calcs": ["mean", "min"], "displayMode": "table", "placement": "right", "showLegend": true },
208+
"legend": {
209+
"calcs": ["mean", "min"],
210+
"displayMode": "table",
211+
"placement": "right",
212+
"showLegend": true
213+
},
189214
"tooltip": { "mode": "multi" }
190215
},
191216
"targets": [
192217
{
193-
"datasource": "mysql",
218+
"datasource": { "type": "mysql", "uid": "mysql" },
194219
"format": "time_series",
195220
"rawQuery": true,
196221
"rawSql": "WITH _credits AS (\n SELECT DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY) AS week_start,\n SUM(credits_used) AS credits\n FROM _tool_q_dev_user_report WHERE $__timeFilter(date)\n GROUP BY DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY)\n),\n_prs AS (\n SELECT DATE_SUB(DATE(merged_date), INTERVAL WEEKDAY(DATE(merged_date)) DAY) AS week_start,\n COUNT(*) AS prs\n FROM pull_requests\n WHERE merged_date IS NOT NULL AND $__timeFilter(merged_date)\n GROUP BY DATE_SUB(DATE(merged_date), INTERVAL WEEKDAY(DATE(merged_date)) DAY)\n)\nSELECT c.week_start AS time,\n ROUND(c.credits / NULLIF(p.prs, 0), 1) AS 'Credits per PR'\nFROM _credits c\nLEFT JOIN _prs p ON c.week_start = p.week_start\nORDER BY time",
@@ -201,16 +226,24 @@
201226
"type": "timeseries"
202227
},
203228
{
204-
"datasource": "mysql",
229+
"datasource": { "type": "mysql", "uid": "mysql" },
205230
"description": "Weekly cost per production deployment",
206231
"fieldConfig": {
207232
"defaults": {
208233
"color": { "mode": "palette-classic" },
209234
"custom": {
210-
"axisBorderShow": false, "axisLabel": "", "axisPlacement": "auto",
211-
"drawStyle": "line", "fillOpacity": 10, "lineInterpolation": "smooth", "lineWidth": 2,
212-
"pointSize": 5, "showPoints": "never", "spanNulls": true,
213-
"stacking": { "mode": "none" }, "thresholdsStyle": { "mode": "off" }
235+
"axisBorderShow": false,
236+
"axisLabel": "",
237+
"axisPlacement": "auto",
238+
"drawStyle": "line",
239+
"fillOpacity": 10,
240+
"lineInterpolation": "smooth",
241+
"lineWidth": 2,
242+
"pointSize": 5,
243+
"showPoints": "never",
244+
"spanNulls": true,
245+
"stacking": { "mode": "none" },
246+
"thresholdsStyle": { "mode": "off" }
214247
},
215248
"unit": "short"
216249
},
@@ -219,12 +252,17 @@
219252
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 },
220253
"id": 12,
221254
"options": {
222-
"legend": { "calcs": ["mean", "min"], "displayMode": "table", "placement": "right", "showLegend": true },
255+
"legend": {
256+
"calcs": ["mean", "min"],
257+
"displayMode": "table",
258+
"placement": "right",
259+
"showLegend": true
260+
},
223261
"tooltip": { "mode": "multi" }
224262
},
225263
"targets": [
226264
{
227-
"datasource": "mysql",
265+
"datasource": { "type": "mysql", "uid": "mysql" },
228266
"format": "time_series",
229267
"rawQuery": true,
230268
"rawSql": "WITH _credits AS (\n SELECT DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY) AS week_start,\n SUM(credits_used) AS credits\n FROM _tool_q_dev_user_report WHERE $__timeFilter(date)\n GROUP BY DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY)\n),\n_deploys AS (\n SELECT DATE_SUB(DATE(finished_date), INTERVAL WEEKDAY(DATE(finished_date)) DAY) AS week_start,\n COUNT(DISTINCT cicd_deployment_id) AS deploys\n FROM cicd_deployment_commits\n WHERE result = 'SUCCESS' AND environment = 'PRODUCTION'\n AND $__timeFilter(finished_date)\n GROUP BY DATE_SUB(DATE(finished_date), INTERVAL WEEKDAY(DATE(finished_date)) DAY)\n)\nSELECT c.week_start AS time,\n ROUND(c.credits / NULLIF(d.deploys, 0), 1) AS 'Credits per Deploy'\nFROM _credits c\nLEFT JOIN _deploys d ON c.week_start = d.week_start\nORDER BY time",
@@ -235,16 +273,24 @@
235273
"type": "timeseries"
236274
},
237275
{
238-
"datasource": "mysql",
276+
"datasource": { "type": "mysql", "uid": "mysql" },
239277
"description": "Weekly cost per resolved issue",
240278
"fieldConfig": {
241279
"defaults": {
242280
"color": { "mode": "palette-classic" },
243281
"custom": {
244-
"axisBorderShow": false, "axisLabel": "", "axisPlacement": "auto",
245-
"drawStyle": "line", "fillOpacity": 10, "lineInterpolation": "smooth", "lineWidth": 2,
246-
"pointSize": 5, "showPoints": "never", "spanNulls": true,
247-
"stacking": { "mode": "none" }, "thresholdsStyle": { "mode": "off" }
282+
"axisBorderShow": false,
283+
"axisLabel": "",
284+
"axisPlacement": "auto",
285+
"drawStyle": "line",
286+
"fillOpacity": 10,
287+
"lineInterpolation": "smooth",
288+
"lineWidth": 2,
289+
"pointSize": 5,
290+
"showPoints": "never",
291+
"spanNulls": true,
292+
"stacking": { "mode": "none" },
293+
"thresholdsStyle": { "mode": "off" }
248294
},
249295
"unit": "short"
250296
},
@@ -253,12 +299,17 @@
253299
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 16 },
254300
"id": 13,
255301
"options": {
256-
"legend": { "calcs": ["mean", "min"], "displayMode": "table", "placement": "right", "showLegend": true },
302+
"legend": {
303+
"calcs": ["mean", "min"],
304+
"displayMode": "table",
305+
"placement": "right",
306+
"showLegend": true
307+
},
257308
"tooltip": { "mode": "multi" }
258309
},
259310
"targets": [
260311
{
261-
"datasource": "mysql",
312+
"datasource": { "type": "mysql", "uid": "mysql" },
262313
"format": "time_series",
263314
"rawQuery": true,
264315
"rawSql": "WITH _credits AS (\n SELECT DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY) AS week_start,\n SUM(credits_used) AS credits\n FROM _tool_q_dev_user_report WHERE $__timeFilter(date)\n GROUP BY DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY)\n),\n_issues AS (\n SELECT DATE_SUB(DATE(resolution_date), INTERVAL WEEKDAY(DATE(resolution_date)) DAY) AS week_start,\n COUNT(*) AS resolved\n FROM issues\n WHERE resolution_date IS NOT NULL AND type != 'INCIDENT'\n AND $__timeFilter(resolution_date)\n GROUP BY DATE_SUB(DATE(resolution_date), INTERVAL WEEKDAY(DATE(resolution_date)) DAY)\n)\nSELECT c.week_start AS time,\n ROUND(c.credits / NULLIF(i.resolved, 0), 1) AS 'Credits per Issue'\nFROM _credits c\nLEFT JOIN _issues i ON c.week_start = i.week_start\nORDER BY time",
@@ -269,16 +320,24 @@
269320
"type": "timeseries"
270321
},
271322
{
272-
"datasource": "mysql",
323+
"datasource": { "type": "mysql", "uid": "mysql" },
273324
"description": "Is cost efficiency improving over time?",
274325
"fieldConfig": {
275326
"defaults": {
276327
"color": { "mode": "palette-classic" },
277328
"custom": {
278-
"axisBorderShow": false, "axisLabel": "", "axisPlacement": "auto",
279-
"drawStyle": "line", "fillOpacity": 10, "lineInterpolation": "smooth", "lineWidth": 2,
280-
"pointSize": 5, "showPoints": "never", "spanNulls": true,
281-
"stacking": { "mode": "none" }, "thresholdsStyle": { "mode": "off" }
329+
"axisBorderShow": false,
330+
"axisLabel": "",
331+
"axisPlacement": "auto",
332+
"drawStyle": "line",
333+
"fillOpacity": 10,
334+
"lineInterpolation": "smooth",
335+
"lineWidth": 2,
336+
"pointSize": 5,
337+
"showPoints": "never",
338+
"spanNulls": true,
339+
"stacking": { "mode": "none" },
340+
"thresholdsStyle": { "mode": "off" }
282341
},
283342
"unit": "short"
284343
},
@@ -287,12 +346,17 @@
287346
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 16 },
288347
"id": 14,
289348
"options": {
290-
"legend": { "calcs": ["mean", "sum"], "displayMode": "table", "placement": "right", "showLegend": true },
349+
"legend": {
350+
"calcs": ["mean", "sum"],
351+
"displayMode": "table",
352+
"placement": "right",
353+
"showLegend": true
354+
},
291355
"tooltip": { "mode": "multi" }
292356
},
293357
"targets": [
294358
{
295-
"datasource": "mysql",
359+
"datasource": { "type": "mysql", "uid": "mysql" },
296360
"format": "time_series",
297361
"rawQuery": true,
298362
"rawSql": "SELECT\n DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY) AS time,\n SUM(credits_used) AS 'Credits',\n SUM(total_messages) AS 'Messages',\n SUM(chat_conversations) AS 'Conversations'\nFROM _tool_q_dev_user_report\nWHERE $__timeFilter(date)\nGROUP BY DATE_SUB(DATE(date), INTERVAL WEEKDAY(DATE(date)) DAY)\nORDER BY time",

0 commit comments

Comments
 (0)