From 913060fe62f621f33f31365cefc60f10f9ca7fd0 Mon Sep 17 00:00:00 2001 From: Jonas Thelemann Date: Thu, 27 Feb 2025 23:37:39 +0100 Subject: [PATCH] feat(grafana): add monthly active users and accounts stat --- .../grafana/dashboards/postgres.json | 189 +++++++++++++++++- 1 file changed, 179 insertions(+), 10 deletions(-) diff --git a/src/production/configurations/grafana/dashboards/postgres.json b/src/production/configurations/grafana/dashboards/postgres.json index 8e6f4601..1ac4b499 100644 --- a/src/production/configurations/grafana/dashboards/postgres.json +++ b/src/production/configurations/grafana/dashboards/postgres.json @@ -22,6 +22,88 @@ "id": 2, "links": [], "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PCC52D03280B7034C" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 3, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PCC52D03280B7034C" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n COUNT(DISTINCT id)\nFROM\n maevsi_private.account\nWHERE\n last_activity >= NOW() - INTERVAL '30 days';\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Monthly active users", + "transparent": true, + "type": "stat" + }, { "datasource": { "type": "grafana-postgresql-datasource", @@ -67,9 +149,9 @@ "overrides": [] }, "gridPos": { - "h": 8, + "h": 12, "w": 12, - "x": 0, + "x": 12, "y": 0 }, "id": 2, @@ -88,13 +170,14 @@ "showValue": "auto", "stacking": "none", "tooltip": { + "hideZeros": false, "mode": "single", "sort": "none" }, - "xTickLabelRotation": 0, + "xTickLabelRotation": -45, "xTickLabelSpacing": 0 }, - "pluginVersion": "11.3.1", + "pluginVersion": "11.5.2", "targets": [ { "datasource": { @@ -125,7 +208,8 @@ } } ], - "title": "Monthly Active Users", + "title": "Last user activity", + "transparent": true, "type": "barchart" }, { @@ -185,10 +269,10 @@ "overrides": [] }, "gridPos": { - "h": 8, + "h": 9, "w": 12, "x": 0, - "y": 8 + "y": 12 }, "id": 1, "options": { @@ -199,11 +283,12 @@ "showLegend": false }, "tooltip": { + "hideZeros": false, "mode": "single", "sort": "none" } }, - "pluginVersion": "11.3.1", + "pluginVersion": "11.5.2", "targets": [ { "datasource": { @@ -234,8 +319,92 @@ } } ], - "title": "User Count", + "title": "User count", + "transparent": true, "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PCC52D03280B7034C" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 12 + }, + "id": 4, + "options": { + "colorMode": "none", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PCC52D03280B7034C" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n COUNT(*)\nFROM\n maevsi_private.account;\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Accounts", + "transparent": true, + "type": "stat" } ], "preload": false, @@ -252,6 +421,6 @@ "timezone": "browser", "title": "Postgres", "uid": "de5jb2krazfnkb", - "version": 1, + "version": 2, "weekStart": "" } \ No newline at end of file