[monitoring] Set rawQuery+editorMode on uk-payslip panel targets

Grafana 11's Postgres plugin shows 'you do not have default database'
on any panel whose target is missing rawQuery:true / editorMode:"code".
The query builder can't reason about a custom schema.table path and
blanks the panel.
This commit is contained in:
Viktor Barzin 2026-04-18 23:12:45 +00:00
parent ed820e9b58
commit 06e3425a39

View file

@ -3,7 +3,10 @@
"list": [ "list": [
{ {
"builtIn": 1, "builtIn": 1,
"datasource": { "type": "datasource", "uid": "grafana" }, "datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true, "enable": true,
"hide": true, "hide": true,
"iconColor": "rgba(0, 211, 255, 1)", "iconColor": "rgba(0, 211, 255, 1)",
@ -12,7 +15,7 @@
} }
] ]
}, },
"description": "UK payslip breakdown gross/net/tax/NI trends, YTD progression against income tax bands, deductions split, and effective rate.", "description": "UK payslip breakdown \u2014 gross/net/tax/NI trends, YTD progression against income tax bands, deductions split, and effective rate.",
"editable": true, "editable": true,
"fiscalYearStartMonth": 0, "fiscalYearStartMonth": 0,
"graphTooltip": 1, "graphTooltip": 1,
@ -23,11 +26,21 @@
"id": 1, "id": 1,
"title": "Monthly gross / net / tax / NI", "title": "Monthly gross / net / tax / NI",
"type": "timeseries", "type": "timeseries",
"datasource": { "type": "grafana-postgresql-datasource", "uid": "payslips-pg" }, "datasource": {
"gridPos": { "h": 9, "w": 12, "x": 0, "y": 0 }, "type": "grafana-postgresql-datasource",
"uid": "payslips-pg"
},
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 0
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "mode": "palette-classic" }, "color": {
"mode": "palette-classic"
},
"unit": "currencyGBP", "unit": "currencyGBP",
"custom": { "custom": {
"axisBorderShow": false, "axisBorderShow": false,
@ -39,28 +52,54 @@
"drawStyle": "line", "drawStyle": "line",
"fillOpacity": 10, "fillOpacity": 10,
"gradientMode": "none", "gradientMode": "none",
"hideFrom": { "legend": false, "tooltip": false, "viz": false }, "hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 2, "lineWidth": 2,
"pointSize": 5, "pointSize": 5,
"scaleDistribution": { "type": "linear" }, "scaleDistribution": {
"type": "linear"
},
"showPoints": "auto", "showPoints": "auto",
"spanNulls": false, "spanNulls": false,
"stacking": { "group": "A", "mode": "none" }, "stacking": {
"thresholdsStyle": { "mode": "off" } "group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
} }
}, },
"overrides": [] "overrides": []
}, },
"options": { "options": {
"legend": { "calcs": ["last", "mean"], "displayMode": "table", "placement": "bottom" }, "legend": {
"tooltip": { "mode": "multi", "sort": "desc" } "calcs": [
"last",
"mean"
],
"displayMode": "table",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}, },
"targets": [ "targets": [
{ {
"datasource": { "type": "grafana-postgresql-datasource", "uid": "payslips-pg" }, "datasource": {
"type": "grafana-postgresql-datasource",
"uid": "payslips-pg"
},
"rawSql": "SELECT pay_date AS \"time\", gross_pay, net_pay, income_tax, national_insurance FROM payslip_ingest.payslip WHERE $__timeFilter(pay_date) ORDER BY pay_date", "rawSql": "SELECT pay_date AS \"time\", gross_pay, net_pay, income_tax, national_insurance FROM payslip_ingest.payslip WHERE $__timeFilter(pay_date) ORDER BY pay_date",
"format": "time_series", "format": "time_series",
"refId": "A" "refId": "A",
"rawQuery": true,
"editorMode": "code"
} }
] ]
}, },
@ -68,11 +107,21 @@
"id": 2, "id": 2,
"title": "YTD gross (this tax year) with UK band thresholds", "title": "YTD gross (this tax year) with UK band thresholds",
"type": "timeseries", "type": "timeseries",
"datasource": { "type": "grafana-postgresql-datasource", "uid": "payslips-pg" }, "datasource": {
"gridPos": { "h": 9, "w": 12, "x": 12, "y": 0 }, "type": "grafana-postgresql-datasource",
"uid": "payslips-pg"
},
"gridPos": {
"h": 9,
"w": 12,
"x": 12,
"y": 0
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "mode": "palette-classic" }, "color": {
"mode": "palette-classic"
},
"unit": "currencyGBP", "unit": "currencyGBP",
"custom": { "custom": {
"axisBorderShow": false, "axisBorderShow": false,
@ -84,37 +133,75 @@
"drawStyle": "line", "drawStyle": "line",
"fillOpacity": 15, "fillOpacity": 15,
"gradientMode": "none", "gradientMode": "none",
"hideFrom": { "legend": false, "tooltip": false, "viz": false }, "hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 2, "lineWidth": 2,
"pointSize": 5, "pointSize": 5,
"scaleDistribution": { "type": "linear" }, "scaleDistribution": {
"type": "linear"
},
"showPoints": "auto", "showPoints": "auto",
"spanNulls": false, "spanNulls": false,
"stacking": { "group": "A", "mode": "none" }, "stacking": {
"thresholdsStyle": { "mode": "line" } "group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "line"
}
}, },
"thresholds": { "thresholds": {
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
{ "color": "green", "value": null }, {
{ "color": "yellow", "value": 12570 }, "color": "green",
{ "color": "orange", "value": 50270 }, "value": null
{ "color": "red", "value": 125140 } },
{
"color": "yellow",
"value": 12570
},
{
"color": "orange",
"value": 50270
},
{
"color": "red",
"value": 125140
}
] ]
} }
}, },
"overrides": [] "overrides": []
}, },
"options": { "options": {
"legend": { "calcs": ["last", "max"], "displayMode": "table", "placement": "bottom" }, "legend": {
"tooltip": { "mode": "multi", "sort": "desc" } "calcs": [
"last",
"max"
],
"displayMode": "table",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}, },
"targets": [ "targets": [
{ {
"datasource": { "type": "grafana-postgresql-datasource", "uid": "payslips-pg" }, "datasource": {
"type": "grafana-postgresql-datasource",
"uid": "payslips-pg"
},
"rawSql": "SELECT pay_date AS \"time\", SUM(gross_pay) OVER (PARTITION BY tax_year ORDER BY pay_date) AS ytd_gross FROM payslip_ingest.payslip WHERE $__timeFilter(pay_date) ORDER BY pay_date", "rawSql": "SELECT pay_date AS \"time\", SUM(gross_pay) OVER (PARTITION BY tax_year ORDER BY pay_date) AS ytd_gross FROM payslip_ingest.payslip WHERE $__timeFilter(pay_date) ORDER BY pay_date",
"format": "time_series", "format": "time_series",
"refId": "A" "refId": "A",
"rawQuery": true,
"editorMode": "code"
} }
] ]
}, },
@ -122,11 +209,21 @@
"id": 3, "id": 3,
"title": "Deductions breakdown per payslip", "title": "Deductions breakdown per payslip",
"type": "timeseries", "type": "timeseries",
"datasource": { "type": "grafana-postgresql-datasource", "uid": "payslips-pg" }, "datasource": {
"gridPos": { "h": 9, "w": 12, "x": 0, "y": 9 }, "type": "grafana-postgresql-datasource",
"uid": "payslips-pg"
},
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 9
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "mode": "palette-classic" }, "color": {
"mode": "palette-classic"
},
"unit": "currencyGBP", "unit": "currencyGBP",
"custom": { "custom": {
"axisBorderShow": false, "axisBorderShow": false,
@ -138,28 +235,54 @@
"drawStyle": "bars", "drawStyle": "bars",
"fillOpacity": 80, "fillOpacity": 80,
"gradientMode": "none", "gradientMode": "none",
"hideFrom": { "legend": false, "tooltip": false, "viz": false }, "hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 1, "lineWidth": 1,
"pointSize": 5, "pointSize": 5,
"scaleDistribution": { "type": "linear" }, "scaleDistribution": {
"type": "linear"
},
"showPoints": "never", "showPoints": "never",
"spanNulls": false, "spanNulls": false,
"stacking": { "group": "A", "mode": "normal" }, "stacking": {
"thresholdsStyle": { "mode": "off" } "group": "A",
"mode": "normal"
},
"thresholdsStyle": {
"mode": "off"
}
} }
}, },
"overrides": [] "overrides": []
}, },
"options": { "options": {
"legend": { "calcs": ["sum", "mean"], "displayMode": "table", "placement": "bottom" }, "legend": {
"tooltip": { "mode": "multi", "sort": "desc" } "calcs": [
"sum",
"mean"
],
"displayMode": "table",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}, },
"targets": [ "targets": [
{ {
"datasource": { "type": "grafana-postgresql-datasource", "uid": "payslips-pg" }, "datasource": {
"type": "grafana-postgresql-datasource",
"uid": "payslips-pg"
},
"rawSql": "SELECT pay_date AS \"time\", income_tax, national_insurance, pension_employee, student_loan FROM payslip_ingest.payslip WHERE $__timeFilter(pay_date) ORDER BY pay_date", "rawSql": "SELECT pay_date AS \"time\", income_tax, national_insurance, pension_employee, student_loan FROM payslip_ingest.payslip WHERE $__timeFilter(pay_date) ORDER BY pay_date",
"format": "time_series", "format": "time_series",
"refId": "A" "refId": "A",
"rawQuery": true,
"editorMode": "code"
} }
] ]
}, },
@ -167,11 +290,21 @@
"id": 4, "id": 4,
"title": "Latest effective rate & take-home %", "title": "Latest effective rate & take-home %",
"type": "timeseries", "type": "timeseries",
"datasource": { "type": "grafana-postgresql-datasource", "uid": "payslips-pg" }, "datasource": {
"gridPos": { "h": 9, "w": 12, "x": 12, "y": 9 }, "type": "grafana-postgresql-datasource",
"uid": "payslips-pg"
},
"gridPos": {
"h": 9,
"w": 12,
"x": 12,
"y": 9
},
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"color": { "mode": "palette-classic" }, "color": {
"mode": "palette-classic"
},
"unit": "percent", "unit": "percent",
"min": 0, "min": 0,
"max": 100, "max": 100,
@ -185,37 +318,72 @@
"drawStyle": "line", "drawStyle": "line",
"fillOpacity": 10, "fillOpacity": 10,
"gradientMode": "none", "gradientMode": "none",
"hideFrom": { "legend": false, "tooltip": false, "viz": false }, "hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 2, "lineWidth": 2,
"pointSize": 5, "pointSize": 5,
"scaleDistribution": { "type": "linear" }, "scaleDistribution": {
"type": "linear"
},
"showPoints": "auto", "showPoints": "auto",
"spanNulls": false, "spanNulls": false,
"stacking": { "group": "A", "mode": "none" }, "stacking": {
"thresholdsStyle": { "mode": "off" } "group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
} }
}, },
"overrides": [] "overrides": []
}, },
"options": { "options": {
"legend": { "calcs": ["last", "mean"], "displayMode": "table", "placement": "bottom" }, "legend": {
"tooltip": { "mode": "multi", "sort": "desc" } "calcs": [
"last",
"mean"
],
"displayMode": "table",
"placement": "bottom"
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
}, },
"targets": [ "targets": [
{ {
"datasource": { "type": "grafana-postgresql-datasource", "uid": "payslips-pg" }, "datasource": {
"type": "grafana-postgresql-datasource",
"uid": "payslips-pg"
},
"rawSql": "SELECT pay_date AS \"time\", ROUND(((income_tax + national_insurance)::numeric / NULLIF(gross_pay, 0)) * 100, 2) AS \"effective_rate_pct\", ROUND((net_pay::numeric / NULLIF(gross_pay, 0)) * 100, 2) AS \"take_home_pct\" FROM payslip_ingest.payslip WHERE $__timeFilter(pay_date) ORDER BY pay_date", "rawSql": "SELECT pay_date AS \"time\", ROUND(((income_tax + national_insurance)::numeric / NULLIF(gross_pay, 0)) * 100, 2) AS \"effective_rate_pct\", ROUND((net_pay::numeric / NULLIF(gross_pay, 0)) * 100, 2) AS \"take_home_pct\" FROM payslip_ingest.payslip WHERE $__timeFilter(pay_date) ORDER BY pay_date",
"format": "time_series", "format": "time_series",
"refId": "A" "refId": "A",
"rawQuery": true,
"editorMode": "code"
} }
] ]
} }
], ],
"refresh": "5m", "refresh": "5m",
"schemaVersion": 39, "schemaVersion": 39,
"tags": ["finance", "personal", "uk-tax"], "tags": [
"templating": { "list": [] }, "finance",
"time": { "from": "now-2y", "to": "now" }, "personal",
"uk-tax"
],
"templating": {
"list": []
},
"time": {
"from": "now-2y",
"to": "now"
},
"timepicker": {}, "timepicker": {},
"timezone": "browser", "timezone": "browser",
"title": "UK Payslip", "title": "UK Payslip",