Skip to content

Commit d7fed8e

Browse files
author
wtao
committed
update dashboard
1 parent 3e2cd84 commit d7fed8e

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

sample/dashboard.json

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
"mode": "absolute",
6969
"steps": [
7070
{
71-
"color": "red"
71+
"color": "red",
72+
"value": null
7273
},
7374
{
7475
"color": "red",
@@ -101,11 +102,12 @@
101102
"pluginVersion": "10.4.2",
102103
"targets": [
103104
{
105+
"collection": "movies",
104106
"datasource": {
105107
"type": "mongodb-grafana-datasource",
106108
"uid": "fdkn0wi0apkw0c"
107109
},
108-
"queryText": "{\n collection: \"movies\",\n aggregations: [\n {\n $match: {\n released: {\n $gte: new Date($from),\n $lte: new Date($to),\n },\n },\n },\n {\n $group: {\n _id: {\n year: {\n $year: \"$released\",\n },\n month: {\n $month: \"$released\",\n },\n },\n __value: {\n $sum: 1,\n },\n },\n },\n {\n $addFields: {\n __name: { $literal: \"movies in month\" },\n __timestamp: {\n $dateFromString: {\n dateString: {\n $concat: [\n {\n $toString: \"$_id.year\",\n },\n \"-\",\n {\n $toString: {\n $cond: {\n if: {\n $lte: [\"$_id.month\", 9],\n },\n then: \"0\",\n else: \"\",\n },\n },\n },\n {\n $toString: \"$_id.month\",\n },\n \"-01\",\n ],\n },\n format: \"%Y-%m-%d\",\n },\n },\n },\n },\n {\n $sort: {\n __timestamp: 1,\n },\n },\n {\n $project: {\n _id: 0,\n },\n },\n ],\n}",
110+
"queryText": "[\n {\n $match: {\n released: {\n $gte: new Date($from),\n $lte: new Date($to),\n },\n },\n },\n {\n $group: {\n _id: {\n year: {\n $year: \"$released\",\n },\n month: {\n $month: \"$released\",\n },\n },\n __value: {\n $sum: 1,\n },\n },\n },\n {\n $addFields: {\n __name: { $literal: \"movies in month\" },\n __timestamp: {\n $dateFromString: {\n dateString: {\n $concat: [\n {\n $toString: \"$_id.year\",\n },\n \"-\",\n {\n $toString: {\n $cond: {\n if: {\n $lte: [\"$_id.month\", 9],\n },\n then: \"0\",\n else: \"\",\n },\n },\n },\n {\n $toString: \"$_id.month\",\n },\n \"-01\",\n ],\n },\n format: \"%Y-%m-%d\",\n },\n },\n },\n },\n {\n $sort: {\n __timestamp: 1,\n },\n },\n {\n $project: {\n _id: 0,\n },\n },\n ]",
109111
"queryType": "timeserie",
110112
"refId": "A"
111113
}
@@ -160,7 +162,8 @@
160162
"mode": "absolute",
161163
"steps": [
162164
{
163-
"color": "green"
165+
"color": "green",
166+
"value": null
164167
},
165168
{
166169
"color": "red",
@@ -192,21 +195,23 @@
192195
},
193196
"targets": [
194197
{
198+
"collection": "movies",
195199
"datasource": {
196200
"type": "mongodb-grafana-datasource",
197201
"uid": "fdkn0wi0apkw0c"
198202
},
199-
"queryText": "{\n collection: \"movies\",\n aggregations: [\n {\n $match: {\n released: {\n $gte: new Date($from),\n $lte: new Date($to),\n },\n },\n },\n {\n $group: {\n _id: {\n year: {\n $year: \"$released\",\n },\n month: {\n $month: \"$released\",\n },\n },\n __value: {\n $sum: 1,\n },\n },\n },\n {\n $addFields: {\n __name: { $literal: \"movies in month\" },\n __timestamp: {\n $dateFromString: {\n dateString: {\n $concat: [\n {\n $toString: \"$_id.year\",\n },\n \"-\",\n {\n $toString: {\n $cond: {\n if: {\n $lte: [\"$_id.month\", 9],\n },\n then: \"0\",\n else: \"\",\n },\n },\n },\n {\n $toString: \"$_id.month\",\n },\n \"-01\",\n ],\n },\n format: \"%Y-%m-%d\",\n },\n },\n },\n },\n {\n $sort: {\n __timestamp: 1,\n },\n },\n {\n $project: {\n _id: 0,\n },\n },\n ],\n}",
203+
"queryText": "[\n {\n $match: {\n released: {\n $gte: new Date($from),\n $lte: new Date($to),\n },\n },\n },\n {\n $group: {\n _id: {\n year: {\n $year: \"$released\",\n },\n month: {\n $month: \"$released\",\n },\n },\n __value: {\n $sum: 1,\n },\n },\n },\n {\n $addFields: {\n __name: { $literal: \"movies in month\" },\n __timestamp: {\n $dateFromString: {\n dateString: {\n $concat: [\n {\n $toString: \"$_id.year\",\n },\n \"-\",\n {\n $toString: {\n $cond: {\n if: {\n $lte: [\"$_id.month\", 9],\n },\n then: \"0\",\n else: \"\",\n },\n },\n },\n {\n $toString: \"$_id.month\",\n },\n \"-01\",\n ],\n },\n format: \"%Y-%m-%d\",\n },\n },\n },\n },\n {\n $sort: {\n __timestamp: 1,\n },\n },\n {\n $project: {\n _id: 0,\n },\n },\n]\n",
200204
"queryType": "timeserie",
201205
"refId": "A"
202206
},
203207
{
208+
"collection": "movies",
204209
"datasource": {
205210
"type": "mongodb-grafana-datasource",
206211
"uid": "fdkn0wi0apkw0c"
207212
},
208213
"hide": false,
209-
"queryText": "{\n \"collection\": \"movies\",\n \"aggregations\": [\n {\n \"$match\": {\n \"released\": {\n \"$gte\": $from,\n \"$lte\": $to\n },\n \"genres\": { \"$elemMatch\": { \"$eq\": \"Comedy\" } }\n }\n },\n {\n \"$group\": {\n \"_id\": {\n \"year\": { \"$year\": \"$released\" },\n \"month\": { \"$month\": \"$released\" }\n },\n \"__value\": { \"$sum\": 1 }\n }\n },\n {\n \"$addFields\": {\n \"__name\": { \"$literal\": \"genre\" },\n \"__timestamp\": {\n \"$dateFromString\": {\n \"dateString\": {\n \"$concat\": [\n { \"$toString\": \"$_id.year\" },\n \"-\",\n {\n \"$toString\": {\n \"$cond\": {\n \"if\": { \"$lte\": [\"$_id.month\", 9] },\n \"then\": \"0\",\n \"else\": \"\"\n }\n }\n },\n { \"$toString\": \"$_id.month\" },\n \"-01\"\n ]\n },\n \"format\": \"%Y-%m-%d\"\n }\n }\n }\n },\n {\n \"$sort\": { \"__timestamp\": 1 }\n },\n {\n \"$project\": { \"_id\": 0 }\n }\n ]\n}\n",
214+
"queryText": " [\n {\n \"$match\": {\n \"released\": {\n \"$gte\": $from,\n \"$lte\": $to\n },\n \"genres\": { \"$elemMatch\": { \"$eq\": \"Comedy\" } }\n }\n },\n {\n \"$group\": {\n \"_id\": {\n \"year\": { \"$year\": \"$released\" },\n \"month\": { \"$month\": \"$released\" }\n },\n \"__value\": { \"$sum\": 1 }\n }\n },\n {\n \"$addFields\": {\n \"__name\": { \"$literal\": \"genre\" },\n \"__timestamp\": {\n \"$dateFromString\": {\n \"dateString\": {\n \"$concat\": [\n { \"$toString\": \"$_id.year\" },\n \"-\",\n {\n \"$toString\": {\n \"$cond\": {\n \"if\": { \"$lte\": [\"$_id.month\", 9] },\n \"then\": \"0\",\n \"else\": \"\"\n }\n }\n },\n { \"$toString\": \"$_id.month\" },\n \"-01\"\n ]\n },\n \"format\": \"%Y-%m-%d\"\n }\n }\n }\n },\n {\n \"$sort\": { \"__timestamp\": 1 }\n },\n {\n \"$project\": { \"_id\": 0 }\n }\n ]\n",
210215
"queryType": "timeserie",
211216
"refId": "B"
212217
}
@@ -243,15 +248,19 @@
243248
},
244249
"id": 5,
245250
"options": {
246-
"displayLabels": ["name"],
251+
"displayLabels": [
252+
"name"
253+
],
247254
"legend": {
248255
"displayMode": "list",
249256
"placement": "bottom",
250257
"showLegend": true
251258
},
252259
"pieType": "pie",
253260
"reduceOptions": {
254-
"calcs": ["lastNotNull"],
261+
"calcs": [
262+
"lastNotNull"
263+
],
255264
"fields": "",
256265
"values": true
257266
},
@@ -263,11 +272,12 @@
263272
"pluginVersion": "10.4.2",
264273
"targets": [
265274
{
275+
"collection": "movies",
266276
"datasource": {
267277
"type": "mongodb-grafana-datasource",
268278
"uid": "fdkn0wi0apkw0c"
269279
},
270-
"queryText": "{\n \"collection\": \"movies\",\n \"aggregations\": [\n {\n \"$unwind\": {\n \"path\": \"$genres\"\n }\n },\n {\n \"$project\": {\n \"genres\": 1\n }\n },\n {\n \"$group\": {\n \"_id\": \"$genres\",\n \"__value\": {\n \"$sum\": 1\n }\n }\n }\n ]\n}",
280+
"queryText": "[\n {\n \"$unwind\": {\n \"path\": \"$genres\"\n }\n },\n {\n \"$project\": {\n \"genres\": 1\n }\n },\n {\n \"$group\": {\n \"_id\": \"$genres\",\n \"__value\": {\n \"$sum\": 1\n }\n }\n }\n]",
271281
"queryType": "table",
272282
"refId": "A"
273283
}
@@ -311,7 +321,8 @@
311321
"mode": "absolute",
312322
"steps": [
313323
{
314-
"color": "green"
324+
"color": "green",
325+
"value": null
315326
},
316327
{
317328
"color": "red",
@@ -334,19 +345,22 @@
334345
"footer": {
335346
"countRows": false,
336347
"fields": "",
337-
"reducer": ["sum"],
348+
"reducer": [
349+
"sum"
350+
],
338351
"show": false
339352
},
340353
"showHeader": true
341354
},
342355
"pluginVersion": "10.4.2",
343356
"targets": [
344357
{
358+
"collection": "movies",
345359
"datasource": {
346360
"type": "mongodb-grafana-datasource",
347361
"uid": "fdkn0wi0apkw0c"
348362
},
349-
"queryText": "{\n collection: \"movies\",\n aggregations: [\n {\n '$match': {\n 'released': {\n '$gte': new Date('Sat, 01 Jan 2000 00:00:00 GMT'), \n '$lte': new Date('Tue, 01 Jan 2002 00:00:00 GMT')\n }\n }\n }, {\n '$project': {\n 'title': 1, \n 'year': 1, \n 'plot': 1\n }\n }\n ]\n}",
363+
"queryText": "[\n {\n '$match': {\n 'released': {\n '$gte': new Date('Sat, 01 Jan 2000 00:00:00 GMT'), \n '$lte': new Date('Tue, 01 Jan 2002 00:00:00 GMT')\n }\n }\n }, {\n '$project': {\n 'title': 1, \n 'year': 1, \n 'plot': 1\n }\n }\n]",
350364
"queryType": "table",
351365
"refId": "A"
352366
}
@@ -355,6 +369,7 @@
355369
"type": "table"
356370
}
357371
],
372+
"refresh": "",
358373
"schemaVersion": 39,
359374
"tags": [],
360375
"templating": {
@@ -368,6 +383,6 @@
368383
"timezone": "browser",
369384
"title": "mflix",
370385
"uid": "bdkpj0btmpr7kc",
371-
"version": 19,
386+
"version": 31,
372387
"weekStart": ""
373-
}
388+
}

0 commit comments

Comments
 (0)