Skip to content

Commit

Permalink
Reduce dashboard loading time (cvat-ai#5833)
Browse files Browse the repository at this point in the history
  • Loading branch information
azhavoro authored Mar 10, 2023
1 parent 28aec51 commit 73e138d
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 51 deletions.
34 changes: 17 additions & 17 deletions components/analytics/grafana/dashboards/all_events.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
}
},
"queryType": "sql",
"rawSql": "SELECT * \r\nFROM events \r\nWHERE $__timeFilter(timestamp)\r\n AND scope IN (${scopes})\r\n AND source IN (${sources})\r\n AND (-1 IN (${users}) OR user_id IN (${users}))\r\n AND (-1 IN (${organizations}) OR org_id IN (${organizations}))\r\n AND (-1 IN (${projects}) OR project_id IN (${projects}))\r\n AND (-1 IN (${tasks}) OR task_id IN (${tasks}))\r\n AND (-1 IN (${jobs}) OR job_id IN (${jobs}))\r\nORDER BY timestamp DESC",
"rawSql": "SELECT * \r\nFROM events \r\nWHERE $__timeFilter(timestamp)\r\n AND scope IN (${scopes})\r\n AND source IN (${sources})\r\n AND (-1 IN (${users}) OR user_id IN (${users}))\r\n AND (-1 IN (${organizations}) OR org_id IN (${organizations}))\r\n AND (-1 IN (${projects}) OR project_id IN (${projects}))\r\n AND (-1 IN (${tasks}) OR task_id IN (${tasks}))\r\n AND (-1 IN (${jobs}) OR job_id IN (${jobs}))\r\nORDER BY timestamp DESC\r\nLIMIT 1000",
"refId": "A"
}
],
Expand Down Expand Up @@ -320,14 +320,14 @@
"type": "grafana-clickhouse-datasource",
"uid": "PDEE91DDB90597936"
},
"definition": "SELECT scope\nFROM events\nWHERE $__timeFilter(timestamp)",
"definition": "SELECT DISTINCT scope\nFROM events\nWHERE $__timeFilter(timestamp)",
"hide": 0,
"includeAll": true,
"label": "Scope",
"multi": true,
"name": "scopes",
"options": [],
"query": "SELECT scope\nFROM events\nWHERE $__timeFilter(timestamp)",
"query": "SELECT DISTINCT scope\nFROM events\nWHERE $__timeFilter(timestamp)",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
Expand All @@ -349,14 +349,14 @@
"type": "grafana-clickhouse-datasource",
"uid": "PDEE91DDB90597936"
},
"definition": "SELECT source\nFROM events\nWHERE $__timeFilter(timestamp)",
"definition": "SELECT DISTINCT source\nFROM events\nWHERE $__timeFilter(timestamp)",
"hide": 0,
"includeAll": true,
"label": "Source",
"multi": true,
"name": "sources",
"options": [],
"query": "SELECT source\nFROM events\nWHERE $__timeFilter(timestamp)",
"query": "SELECT DISTINCT source\nFROM events\nWHERE $__timeFilter(timestamp)",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
Expand All @@ -378,14 +378,14 @@
"type": "grafana-clickhouse-datasource",
"uid": "PDEE91DDB90597936"
},
"definition": "SELECT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND user_id IS NOT NULL",
"definition": "SELECT DISTINCT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND user_id IS NOT NULL",
"hide": 0,
"includeAll": true,
"label": "User",
"multi": true,
"name": "users",
"options": [],
"query": "SELECT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND user_id IS NOT NULL",
"query": "SELECT DISTINCT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND user_id IS NOT NULL",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand All @@ -407,14 +407,14 @@
"type": "grafana-clickhouse-datasource",
"uid": "PDEE91DDB90597936"
},
"definition": "SELECT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL",
"definition": "SELECT DISTINCT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL",
"hide": 0,
"includeAll": true,
"label": "Project",
"multi": true,
"name": "projects",
"options": [],
"query": "SELECT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL",
"query": "SELECT DISTINCT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand All @@ -436,14 +436,14 @@
"type": "grafana-clickhouse-datasource",
"uid": "PDEE91DDB90597936"
},
"definition": "SELECT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL",
"definition": "SELECT DISTINCT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL",
"hide": 0,
"includeAll": true,
"label": "Task",
"multi": true,
"name": "tasks",
"options": [],
"query": "SELECT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL",
"query": "SELECT DISTINCT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand All @@ -465,14 +465,14 @@
"type": "grafana-clickhouse-datasource",
"uid": "PDEE91DDB90597936"
},
"definition": "SELECT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL",
"definition": "SELECT DISTINCT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL",
"hide": 0,
"includeAll": true,
"label": "Job",
"multi": true,
"name": "jobs",
"options": [],
"query": "SELECT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL",
"query": "SELECT DISTINCT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand All @@ -494,14 +494,14 @@
"type": "grafana-clickhouse-datasource",
"uid": "PDEE91DDB90597936"
},
"definition": "SELECT org_id\nFROM events\nWHERE $__timeFilter(timestamp)\nAND org_id IS NOT NULL",
"definition": "SELECT DISTINCT org_id\nFROM events\nWHERE $__timeFilter(timestamp)\nAND org_id IS NOT NULL",
"hide": 0,
"includeAll": true,
"label": "Organization",
"multi": true,
"name": "organizations",
"options": [],
"query": "SELECT org_id\nFROM events\nWHERE $__timeFilter(timestamp)\nAND org_id IS NOT NULL",
"query": "SELECT DISTINCT org_id\nFROM events\nWHERE $__timeFilter(timestamp)\nAND org_id IS NOT NULL",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
Expand All @@ -511,13 +511,13 @@
]
},
"time": {
"from": "now-5y",
"from": "now-7d",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "All events",
"uid": "EIGSTDAVz",
"version": 1,
"version": 3,
"weekStart": ""
}
23 changes: 10 additions & 13 deletions components/analytics/grafana/dashboards/management.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@
"groupBy": [
"user_id"
],
"limit": null,
"metrics": [
{
"aggregation": "count",
Expand All @@ -167,7 +166,6 @@
"groupBy": [
"user_id"
],
"limit": null,
"metrics": [
{
"aggregation": "count",
Expand Down Expand Up @@ -272,7 +270,6 @@
"builderOptions": {
"fields": [],
"filters": [],
"limit": 100,
"metrics": [
{
"aggregation": "count",
Expand All @@ -292,7 +289,7 @@
},
"format": 0,
"queryType": "builder",
"rawSql": "SELECT $__timeInterval(timestamp) as time, count(*) Count FROM events WHERE $__timeFilter(timestamp) GROUP BY time ORDER BY time ASC LIMIT 100",
"rawSql": "SELECT $__timeInterval(timestamp) as time, count(*) Count FROM events WHERE $__timeFilter(timestamp) GROUP BY time ORDER BY time ASC",
"refId": "A"
}
],
Expand Down Expand Up @@ -398,14 +395,14 @@
"type": "grafana-clickhouse-datasource",
"uid": "PDEE91DDB90597936"
},
"definition": "SELECT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND source = 'client'",
"definition": "SELECT DISTINCT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND source = 'client'",
"hide": 0,
"includeAll": true,
"label": "User",
"multi": true,
"name": "users",
"options": [],
"query": "SELECT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND source = 'client'",
"query": "SELECT DISTINCT user_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND source = 'client'",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
Expand All @@ -427,14 +424,14 @@
"type": "grafana-clickhouse-datasource",
"uid": "PDEE91DDB90597936"
},
"definition": "SELECT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL\n AND source = 'client'",
"definition": "SELECT DISTINCT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL\n AND source = 'client'",
"hide": 0,
"includeAll": true,
"label": "Project",
"multi": true,
"name": "projects",
"options": [],
"query": "SELECT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL\n AND source = 'client'",
"query": "SELECT DISTINCT project_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND project_id IS NOT NULL\n AND source = 'client'",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
Expand All @@ -451,15 +448,15 @@
"type": "grafana-clickhouse-datasource",
"uid": "PDEE91DDB90597936"
},
"definition": "SELECT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL\n AND source = 'client'\n AND (-1 IN (${projects}) OR project_id IN (${projects}))",
"definition": "SELECT DISTINCT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL\n AND source = 'client'\n AND (-1 IN (${projects}) OR project_id IN (${projects}))",
"description": "",
"hide": 0,
"includeAll": true,
"label": "Task",
"multi": true,
"name": "tasks",
"options": [],
"query": "SELECT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL\n AND source = 'client'\n AND (-1 IN (${projects}) OR project_id IN (${projects}))",
"query": "SELECT DISTINCT task_id\nFROM events\nWHERE $__timeFilter(timestamp) \n AND task_id IS NOT NULL\n AND source = 'client'\n AND (-1 IN (${projects}) OR project_id IN (${projects}))",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
Expand All @@ -480,14 +477,14 @@
"type": "grafana-clickhouse-datasource",
"uid": "PDEE91DDB90597936"
},
"definition": "SELECT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL\n AND source = 'client'\n AND task_id in (${tasks})",
"definition": "SELECT DISTINCT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL\n AND source = 'client'\n AND task_id in (${tasks})",
"hide": 0,
"includeAll": true,
"label": "Job",
"multi": true,
"name": "jobs",
"options": [],
"query": "SELECT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL\n AND source = 'client'\n AND task_id in (${tasks})",
"query": "SELECT DISTINCT job_id\nFROM events\nWHERE $__timeFilter(timestamp)\n AND job_id IS NOT NULL\n AND source = 'client'\n AND task_id in (${tasks})",
"refresh": 2,
"regex": "",
"skipUrlSync": false,
Expand All @@ -504,6 +501,6 @@
"timezone": "",
"title": "Management",
"uid": "w0if6WAVz",
"version": 1,
"version": 2,
"weekStart": ""
}
Loading

0 comments on commit 73e138d

Please sign in to comment.