From dd0b600aeaf8b3e0617caf7ce7cc03bb20465282 Mon Sep 17 00:00:00 2001 From: Axel Date: Sun, 2 Mar 2025 10:50:49 +0100 Subject: [PATCH] Update Grafana dashboard from Lumen V5 --- grafana/dashboard.json | 1591 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1591 insertions(+) create mode 100644 grafana/dashboard.json diff --git a/grafana/dashboard.json b/grafana/dashboard.json new file mode 100644 index 0000000..9f5c4ce --- /dev/null +++ b/grafana/dashboard.json @@ -0,0 +1,1591 @@ +{ + "__inputs": [ + { + "name": "DS_LUMEN", + "label": "Lumen", + "description": "", + "type": "datasource", + "pluginId": "grafana-postgresql-datasource", + "pluginName": "PostgreSQL" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "11.5.0" + }, + { + "type": "datasource", + "id": "grafana-postgresql-datasource", + "name": "PostgreSQL", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + }, + { + "type": "panel", + "id": "text", + "name": "Text", + "version": "" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + } + ], + "annotations": { + "list": [ + { + "$$hashKey": "object:7", + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "panels": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "links": [], + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "duration" + }, + "properties": [ + { + "id": "unit", + "value": "dthms" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "avg" + }, + "properties": [ + { + "id": "unit", + "value": "dthms" + } + ] + } + ] + }, + "gridPos": { + "h": 21, + "w": 10, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"Time\" AS \"time\",\n \"AmountVideos\" as amount\nFROM youtubewatchlist.\"YoutubeWatchlist\"\nWHERE\n $__timeFilter(\"Time\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "amount" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "yt_stats", + "timeColumn": "date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"Time\" AS \"time\",\n \"SecondsDuration\" as duration\nFROM youtubewatchlist.\"YoutubeWatchlist\"\nWHERE\n $__timeFilter(\"Time\")\nORDER BY 1", + "refId": "B", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "yt_stats", + "timeColumn": "date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"Time\" AS \"time\",\n \"SecondsDuration\" / \"AmountVideos\" as \"avg\" \nFROM youtubewatchlist.\"YoutubeWatchlist\"\nWHERE\n $__timeFilter(\"Time\")\nORDER BY 1", + "refId": "C", + "select": [ + [ + { + "params": [ + "amount" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "yt_stats", + "timeColumn": "date", + "timeColumnType": "timestamptz", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Watchlist status", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": true, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "line" + } + }, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "transparent", + "value": 0 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "durationdiff" + }, + "properties": [ + { + "id": "unit", + "value": "dthms" + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 11, + "x": 10, + "y": 0 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"Time\" AS \"time\",\n \"AmountVideos\" - (SELECT \"AmountVideos\" FROM youtubewatchlist.\"YoutubeWatchlist\" b WHERE (a.\"Time\" - interval '3 month') > b.\"Time\" ORDER BY \"Time\" DESC LIMIT 1) as amountDiff\nFROM youtubewatchlist.\"YoutubeWatchlist\" a\nWHERE\n $__timeFilter(\"Time\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "amount" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "yt_stats", + "timeColumn": "date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"Time\" AS \"time\",\n \"SecondsDuration\" - (SELECT \"SecondsDuration\" FROM youtubewatchlist.\"YoutubeWatchlist\" b WHERE (a.\"Time\" - interval '3 month') > b.\"Time\" ORDER BY \"Time\" DESC LIMIT 1) as durationDiff\nFROM youtubewatchlist.\"YoutubeWatchlist\" a\nWHERE\n $__timeFilter(\"Time\")\nORDER BY 1", + "refId": "B", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "yt_stats", + "timeColumn": "date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Differences vs 3 month (or closest to) before", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 21, + "y": 0 + }, + "id": 6, + "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.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \"AmountVideos\" FROM youtubewatchlist.\"YoutubeWatchlist\" ORDER BY \"Time\" DESC LIMIT 1 ", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "amount", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 1, + "orderBy": { + "property": { + "name": "date", + "type": "string" + }, + "type": "property" + }, + "orderByDirection": "DESC" + }, + "table": "yt_stats" + } + ], + "title": "Amount left", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + } + ] + }, + "unit": "dateTimeAsLocal" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 21, + "y": 3 + }, + "id": 8, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^max$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT MAX(\"Time\")\r\nFROM youtubewatchlist.\"YoutubeWatchlist\"\r\nWHERE \"AmountVideos\" < (\r\n SELECT \"AmountVideos\" FROM youtubewatchlist.\"YoutubeWatchlist\" ORDER BY \"Time\" DESC LIMIT 1\r\n)", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "amount", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 1, + "orderBy": { + "property": { + "name": "date", + "type": "string" + }, + "type": "property" + }, + "orderByDirection": "DESC" + }, + "table": "yt_stats" + } + ], + "title": "Last time this low", + "type": "stat" + }, + { + "gridPos": { + "h": 1, + "w": 3, + "x": 21, + "y": 6 + }, + "id": 11, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "", + "mode": "markdown" + }, + "pluginVersion": "11.5.0", + "type": "text" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": true, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "line" + } + }, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "transparent", + "value": 0 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "durationdiff" + }, + "properties": [ + { + "id": "unit", + "value": "dthms" + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 11, + "x": 10, + "y": 7 + }, + "id": 13, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"Time\" AS \"time\",\n \"AmountVideos\" - (SELECT \"AmountVideos\" FROM youtubewatchlist.\"YoutubeWatchlist\" b WHERE (a.\"Time\" - interval '1 month') > b.\"Time\" ORDER BY \"Time\" DESC LIMIT 1) as amountDiff\nFROM youtubewatchlist.\"YoutubeWatchlist\" a\nWHERE\n $__timeFilter(\"Time\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "amount" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "yt_stats", + "timeColumn": "date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"Time\" AS \"time\",\n \"SecondsDuration\" - (SELECT \"SecondsDuration\" FROM youtubewatchlist.\"YoutubeWatchlist\" b WHERE (a.\"Time\" - interval '1 month') > b.\"Time\" ORDER BY \"Time\" DESC LIMIT 1) as durationDiff\nFROM youtubewatchlist.\"YoutubeWatchlist\" a\nWHERE\n $__timeFilter(\"Time\")\nORDER BY 1\n", + "refId": "B", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "yt_stats", + "timeColumn": "date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Differences vs 1 month (or closest to) before", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + } + ] + }, + "unit": "dthms" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 21, + "y": 7 + }, + "id": 7, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^duration$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \"SecondsDuration\" as duration FROM youtubewatchlist.\"YoutubeWatchlist\" ORDER BY \"Time\" DESC LIMIT 1 ", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "duration", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 1, + "orderBy": { + "property": { + "name": "date", + "type": "string" + }, + "type": "property" + }, + "orderByDirection": "DESC" + }, + "table": "yt_stats" + } + ], + "title": "Total time left", + "type": "stat" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + } + ] + }, + "unit": "dateTimeAsLocal" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 21, + "y": 10 + }, + "id": 9, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^max$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT MAX(\"Time\")\r\nFROM youtubewatchlist.\"YoutubeWatchlist\"\r\nWHERE \"SecondsDuration\" < (\r\n SELECT \"SecondsDuration\" FROM youtubewatchlist.\"YoutubeWatchlist\" ORDER BY \"Time\" DESC LIMIT 1\r\n)", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "amount", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 1, + "orderBy": { + "property": { + "name": "date", + "type": "string" + }, + "type": "property" + }, + "orderByDirection": "DESC" + }, + "table": "yt_stats" + } + ], + "title": "Last time this low", + "type": "stat" + }, + { + "gridPos": { + "h": 1, + "w": 3, + "x": 21, + "y": 13 + }, + "id": 12, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "", + "mode": "markdown" + }, + "pluginVersion": "11.5.0", + "type": "text" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": true, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "stepAfter", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "line" + } + }, + "links": [], + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "transparent", + "value": 0 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "durationdiff" + }, + "properties": [ + { + "id": "unit", + "value": "dthms" + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 11, + "x": 10, + "y": 14 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.5.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"Time\" AS \"time\",\n \"AmountVideos\" - (SELECT \"AmountVideos\" FROM youtubewatchlist.\"YoutubeWatchlist\" b WHERE (a.\"Time\" - interval '1w') > b.\"Time\" ORDER BY \"Time\" DESC LIMIT 1) as amountDiff\nFROM youtubewatchlist.\"YoutubeWatchlist\" a\nWHERE\n $__timeFilter(\"Time\")\nORDER BY 1", + "refId": "A", + "select": [ + [ + { + "params": [ + "amount" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "yt_stats", + "timeColumn": "date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "time_series", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n \"Time\" AS \"time\",\n \"SecondsDuration\" - (SELECT \"SecondsDuration\" FROM youtubewatchlist.\"YoutubeWatchlist\" b WHERE (a.\"Time\" - interval '1w') > b.\"Time\" ORDER BY \"Time\" DESC LIMIT 1) as durationDiff\nFROM youtubewatchlist.\"YoutubeWatchlist\" a\nWHERE\n $__timeFilter(\"Time\")\nORDER BY 1", + "refId": "B", + "select": [ + [ + { + "params": [ + "duration" + ], + "type": "column" + } + ] + ], + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "yt_stats", + "timeColumn": "date", + "timeColumnType": "timestamp", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Differences vs 7d (or closest to) before", + "type": "timeseries" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + } + ] + }, + "unit": "dthms" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 21, + "y": 14 + }, + "id": 10, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^avg$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\r\n \"SecondsDuration\" / \"AmountVideos\" as \"avg\" \r\nFROM youtubewatchlist.\"YoutubeWatchlist\"\r\nORDER BY \"Time\" DESC\r\nLIMIT 1", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "amount", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 1, + "orderBy": { + "property": { + "name": "date", + "type": "string" + }, + "type": "property" + }, + "orderByDirection": "DESC" + }, + "table": "yt_stats" + } + ], + "title": "Avg. (total/amount)", + "type": "stat" + }, + { + "gridPos": { + "h": 1, + "w": 3, + "x": 21, + "y": 17 + }, + "id": 14, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "", + "mode": "markdown" + }, + "pluginVersion": "11.5.0", + "type": "text" + }, + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + } + ] + }, + "unit": "dthms" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 3, + "x": 21, + "y": 18 + }, + "id": 15, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [], + "fields": "/^max$/", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.0", + "targets": [ + { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "${DS_LUMEN}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT MAX(\"Time\") FROM youtubewatchlist.\"YoutubeWatchlist\"", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "amount", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 1, + "orderBy": { + "property": { + "name": "date", + "type": "string" + }, + "type": "property" + }, + "orderByDirection": "DESC" + }, + "table": "yt_stats" + } + ], + "title": "Last update", + "type": "stat" + } + ], + "refresh": "", + "schemaVersion": 40, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-90d", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Youtube stats", + "uid": "Vnv9NfJnk", + "version": 5, + "weekStart": "" +}