From 995105f6ddf2d49b811e43c254f61e135887e5d4 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 15 Oct 2025 11:20:49 +0300 Subject: [PATCH] add node logs + change postgres exporter --- node-logs.json | 288 ++++++ postgresexporter.json | 1997 ++++++++++++++++++++++++++++++----------- 2 files changed, 1755 insertions(+), 530 deletions(-) create mode 100644 node-logs.json diff --git a/node-logs.json b/node-logs.json new file mode 100644 index 0000000..0acf975 --- /dev/null +++ b/node-logs.json @@ -0,0 +1,288 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "description": "Node logs", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 20, + "links": [], + "liveNow": true, + "panels": [ + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "bars", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": false + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.1.0", + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "direction": "backward", + "editorMode": "code", + "expr": "sum(count_over_time({cluster=~\"$cluster\", instance=~\"$Node\", job=~\"integrations/kubernetes/journal\"} |~ \"$search\"[$__interval]))", + "instant": false, + "legendFormat": "Log count", + "queryType": "range", + "range": true, + "refId": "A" + } + ], + "title": "Log count", + "type": "timeseries" + }, + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [] + }, + "gridPos": { + "h": 16, + "w": 24, + "x": 0, + "y": 5 + }, + "id": 3, + "options": { + "dedupStrategy": "exact", + "enableInfiniteScrolling": false, + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": true, + "showTime": true, + "sortOrder": "Descending", + "wrapLogMessage": true + }, + "pluginVersion": "12.1.0", + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "loki" + }, + "direction": "backward", + "editorMode": "code", + "expr": "{cluster=~\"$cluster\", instance=~\"$Node\", job=~\"integrations/kubernetes/journal\"} |~ `(?i)$search`", + "queryType": "range", + "refId": "A" + } + ], + "title": "Logs Panel", + "type": "logs" + } + ], + "preload": false, + "refresh": "10s", + "schemaVersion": 41, + "tags": [], + "templating": { + "list": [ + { + "allValue": ".+", + "current": { + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "loki", + "uid": "loki" + }, + "definition": "", + "description": "", + "includeAll": true, + "label": "Cluster", + "name": "cluster", + "options": [], + "query": { + "label": "cluster", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "", + "type": 1 + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "allValue": ".+", + "current": { + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "loki", + "uid": "loki" + }, + "definition": "", + "includeAll": true, + "label": "Node", + "name": "Node", + "options": [], + "query": { + "label": "node", + "refId": "LokiVariableQueryEditor-VariableQuery", + "stream": "{cluster=~\"$cluster\"}", + "type": 1 + }, + "refresh": 1, + "regex": "", + "type": "query" + }, + { + "current": { + "text": "warn|error|fatal", + "value": "warn|error|fatal" + }, + "includeAll": false, + "label": "Search Term", + "name": "search", + "options": [ + { + "selected": false, + "text": "error|fatal", + "value": "error|fatal" + }, + { + "selected": true, + "text": "warn|error|fatal", + "value": "warn|error|fatal" + }, + { + "selected": false, + "text": "fatal", + "value": "fatal" + }, + { + "selected": false, + "text": "error", + "value": "error" + }, + { + "selected": false, + "text": "warn", + "value": "warn" + }, + { + "selected": false, + "text": "info", + "value": "info" + }, + { + "selected": false, + "text": ".+", + "value": ".+" + } + ], + "query": "error|fatal,warn|error|fatal,fatal,error,warn,info,.+", + "type": "custom" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Node logs", + "uid": "ae3ec2c4-1c19-4450-9403-226270fe0c4f", + "version": 14 +} \ No newline at end of file diff --git a/postgresexporter.json b/postgresexporter.json index 0b9de4d..10d1a48 100644 --- a/postgresexporter.json +++ b/postgresexporter.json @@ -18,7 +18,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 49, + "id": 22, "links": [], "panels": [ { @@ -931,6 +931,966 @@ "x": 0, "y": 23 }, + "id": 20, + "panels": [], + "title": "Queries", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 20, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 24 + }, + "id": 40, + "options": { + "legend": { + "calcs": [ + "mean", + "max", + "min" + ], + "displayMode": "table", + "placement": "right", + "showLegend": true, + "sortBy": "Max", + "sortDesc": false + }, + "tooltip": { + "hideZeros": false, + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "12.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prom" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "sum by(datname) (\r\n rate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n)\r\nor\r\nsum by(datname) (\r\n irate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n)", + "format": "time_series", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "$__interval_ms", + "intervalFactor": 1, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Statements Calls", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prom" + }, + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "decimals": 2, + "displayName": "", + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "queryid" + }, + "properties": [ + { + "id": "displayName", + "value": "Query ID" + }, + { + "id": "custom.align" + }, + { + "id": "unit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Time" + }, + "properties": [ + { + "id": "displayName", + "value": "Time" + }, + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.hidden", + "value": true + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Value" + }, + "properties": [ + { + "id": "displayName", + "value": "Calls/sec" + }, + { + "id": "unit", + "value": "ops" + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "custom.align" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0.97)", + "value": 0 + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 100 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 1000 + }, + { + "value": 10000 + } + ] + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "instance" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.hidden", + "value": true + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "job" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.hidden", + "value": true + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "tier" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.hidden", + "value": true + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "type" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.hidden", + "value": true + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "query" + }, + "properties": [ + { + "id": "custom.width", + "value": 217 + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 24, + "x": 0, + "y": 33 + }, + "id": 41, + "links": [ + { + "url": "/" + } + ], + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [ + { + "desc": true, + "displayName": "Query ID" + } + ] + }, + "pluginVersion": "12.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prom" + }, + "disableTextWrap": false, + "dsType": "influxdb", + "editorMode": "code", + "expr": "(\r\n sort_desc(\r\n topk(\r\n 10,\r\n rate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n or irate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n)\r\n* on (queryid, instance)\r\ngroup_left(query)\r\nmax by (instance, queryid, query) (\r\n pg_stat_statements_query_id{instance=~\"$Instance\"}\r\n)\r\n", + "format": "table", + "fullMetaSearch": false, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "includeNullMetadata": true, + "instant": true, + "interval": "$__interval_ms", + "intervalFactor": 1, + "legendFormat": "", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [], + "useBackend": false + } + ], + "title": "Most Called Queries", + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prom" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 43 + }, + "id": 42, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "12.1.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prom" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "(sum by(datname) (rate(pg_stat_statements_seconds_total{datname=~\"$Database\", instance=\"$Instance\"}[$__interval_ms])) > 0) or (irate(pg_stat_statements_time_milliseconds{datname=~\"$datname\", instance=\"$host\"}[5m]))", + "format": "time_series", + "fullMetaSearch": false, + "includeNullMetadata": true, + "interval": "$__interval_ms", + "intervalFactor": 1, + "legendFormat": "{{datname}}", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "Total Duration of Queries", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prom" + }, + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 51 + }, + "id": 44, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "12.1.0", + "targets": [ + { + "datasource": { + "uid": "Prometheus" + }, + "disableTextWrap": false, + "dsType": "influxdb", + "editorMode": "code", + "expr": "topk(\r\n 10,\r\n (\r\n rate(pg_stat_statements_seconds_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n /\r\n rate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n)\r\n* on (queryid, instance)\r\ngroup_left(query)\r\nmax by (instance, queryid, query) (\r\n pg_stat_statements_query_id{instance=~\"$Instance\"}\r\n)\r\n", + "format": "table", + "fullMetaSearch": false, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "includeNullMetadata": true, + "instant": true, + "interval": "$__interval_ms", + "intervalFactor": 1, + "legendFormat": "", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [], + "useBackend": false + } + ], + "title": "Average Runtime", + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prom" + }, + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 58 + }, + "id": 43, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "12.1.0", + "targets": [ + { + "datasource": { + "uid": "Prometheus" + }, + "disableTextWrap": false, + "dsType": "influxdb", + "editorMode": "code", + "expr": "sort_desc(topk(10, rate(pg_stat_database_active_time_seconds_total{datname=~\"$Database\", instance=\"$Instance\"}[$__interval_ms])))", + "format": "table", + "fullMetaSearch": false, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "includeNullMetadata": true, + "instant": true, + "interval": "$__interval_ms", + "intervalFactor": 1, + "legendFormat": "", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [], + "useBackend": false + } + ], + "title": "Queries Duration", + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prom" + }, + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "decimals": 2, + "displayName": "", + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": 0 + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Time" + }, + "properties": [ + { + "id": "displayName", + "value": "Time" + }, + { + "id": "custom.hidden", + "value": true + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "queryid" + }, + "properties": [ + { + "id": "displayName", + "value": "Query ID" + }, + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.align" + }, + { + "id": "unit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Value" + }, + "properties": [ + { + "id": "displayName", + "value": "Duration" + }, + { + "id": "unit", + "value": "ms" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.align" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 65 + }, + "id": 45, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "12.1.0", + "targets": [ + { + "datasource": { + "uid": "Prometheus" + }, + "disableTextWrap": false, + "dsType": "influxdb", + "editorMode": "code", + "expr": "(\r\n sort_desc(\r\n topk(\r\n 5,\r\n sum by(queryid, datname, user) (\r\n irate(pg_stat_statements_seconds_total{instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n )\r\n unless (\r\n topk(\r\n 20,\r\n sum by(queryid, datname, user) (\r\n irate(pg_stat_statements_time_milliseconds{instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n )\r\n)\r\n* on (queryid)\r\ngroup_left(instance, query)\r\nmax by (instance, queryid, query) (\r\n pg_stat_statements_query_id{instance=~\"$Instance\"}\r\n)\r\n", + "format": "table", + "fullMetaSearch": false, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "includeNullMetadata": true, + "instant": false, + "interval": "$__interval_ms", + "intervalFactor": 1, + "legendFormat": "", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [], + "useBackend": false + } + ], + "title": "New Slow Queries for All Databases", + "type": "table" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 73 + }, "id": 27, "panels": [], "title": "Transactions", @@ -1002,7 +1962,7 @@ "h": 7, "w": 24, "x": 0, - "y": 24 + "y": 74 }, "id": 14, "options": { @@ -1031,7 +1991,7 @@ "uid": "prom" }, "editorMode": "code", - "expr": "sum ((rate(pg_stat_database_xact_commit[$__interval_ms])))", + "expr": "sum ((delta(pg_stat_database_xact_commit[$__interval_ms])))", "interval": "", "legendFormat": "committed", "range": true, @@ -1043,7 +2003,7 @@ "uid": "prom" }, "editorMode": "code", - "expr": "sum ((rate(pg_stat_database_xact_rollback[$__interval_ms])))", + "expr": "sum ((delta(pg_stat_database_xact_rollback[$__interval_ms])))", "hide": false, "interval": "", "legendFormat": "rollback", @@ -1121,7 +2081,7 @@ "h": 7, "w": 12, "x": 0, - "y": 31 + "y": 81 }, "id": 24, "options": { @@ -1150,7 +2110,7 @@ "uid": "prom" }, "editorMode": "code", - "expr": "sum((rate(pg_stat_database_tup_inserted{instance=\"$Instance\"}[$__interval_ms])))", + "expr": "sum((delta(pg_stat_database_tup_inserted{instance=\"$Instance\"}[$__interval_ms])))", "interval": "", "legendFormat": "Inserts", "range": true, @@ -1161,9 +2121,11 @@ "type": "prometheus", "uid": "prom" }, - "expr": "sum((rate(pg_stat_database_tup_updated{instance=\"$Instance\"}[$__interval_ms])))", + "editorMode": "code", + "expr": "sum((delta(pg_stat_database_tup_updated{instance=\"$Instance\"}[$__interval_ms])))", "interval": "", "legendFormat": "Updates", + "range": true, "refId": "B" }, { @@ -1172,7 +2134,7 @@ "uid": "prom" }, "editorMode": "code", - "expr": "sum((rate(pg_stat_database_tup_deleted{instance=\"$Instance\"}[$__interval_ms])))", + "expr": "sum((delta(pg_stat_database_tup_deleted{instance=\"$Instance\"}[$__interval_ms])))", "interval": "", "legendFormat": "Deletes", "range": true, @@ -1246,7 +2208,7 @@ "h": 7, "w": 12, "x": 12, - "y": 31 + "y": 81 }, "id": 29, "options": { @@ -1267,10 +2229,10 @@ { "disableTextWrap": false, "editorMode": "code", - "expr": "pg_stat_activity_max_tx_duration", + "expr": "pg_stat_activity_max_tx_duration{instance=\"$Instance\"}", "fullMetaSearch": false, "includeNullMetadata": true, - "legendFormat": "{{instance}}", + "legendFormat": "{{instance}} / {{datname}} ({{state}})", "range": true, "refId": "A", "useBackend": false @@ -1346,7 +2308,7 @@ "h": 8, "w": 12, "x": 0, - "y": 38 + "y": 88 }, "id": 25, "options": { @@ -1460,7 +2422,7 @@ "h": 8, "w": 12, "x": 12, - "y": 38 + "y": 88 }, "id": 26, "options": { @@ -1488,9 +2450,11 @@ "type": "prometheus", "uid": "prom" }, - "expr": "sum((rate(pg_stat_database_tup_fetched{instance=\"$Instance\"}[$__interval_ms])))", + "editorMode": "code", + "expr": "sum((delta(pg_stat_database_tup_fetched{instance=\"$Instance\"}[$__interval_ms])))", "interval": "", "legendFormat": "Fetched", + "range": true, "refId": "A" }, { @@ -1498,9 +2462,11 @@ "type": "prometheus", "uid": "prom" }, - "expr": "sum((rate(pg_stat_database_tup_returned{instance=\"$Instance\"}[$__interval_ms])))", + "editorMode": "code", + "expr": "sum((delta(pg_stat_database_tup_returned{instance=\"$Instance\"}[$__interval_ms])))", "interval": "", "legendFormat": "Returned", + "range": true, "refId": "B" } ], @@ -1513,397 +2479,7 @@ "h": 1, "w": 24, "x": 0, - "y": 46 - }, - "id": 20, - "panels": [], - "title": "Queries", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prom" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 47 - }, - "id": 40, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.1.0", - "targets": [ - { - "disableTextWrap": false, - "editorMode": "code", - "expr": "topk(5,\r\n (\r\n increase(pg_stat_statements_seconds_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n /\r\n increase(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n)\r\n*\r\non(queryid, instance)\r\ngroup_left(query)\r\npg_stat_statements_query_id{instance=~\"$Instance\"}\r\n", - "fullMetaSearch": false, - "includeNullMetadata": true, - "legendFormat": "{{datname}} : {{query}}", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "title": "Top 5 Slowest Queries by Average Time", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prom" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "s" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 47 - }, - "id": 19, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.1.0", - "targets": [ - { - "editorMode": "code", - "expr": "topk(5,\r\n increase(\r\n pg_stat_statements_seconds_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms]\r\n )\r\n)\r\n*\r\non(queryid, instance)\r\ngroup_left(query)\r\npg_stat_statements_query_id{instance=~\"$Instance\"}", - "legendFormat": "{{datname}} : {{query}}", - "range": true, - "refId": "A" - } - ], - "title": "Top 5 Queries by Total Execution Time ", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prom" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 55 - }, - "id": 17, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.1.0", - "targets": [ - { - "editorMode": "code", - "expr": "topk(5,\r\n increase(\r\n pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms]\r\n )\r\n)\r\n*\r\non(queryid, instance)\r\ngroup_left(query)\r\npg_stat_statements_query_id{instance=~\"$Instance\"}\r\n", - "legendFormat": "{{datname}} : {{query}}", - "range": true, - "refId": "A" - } - ], - "title": "Top 5 Most Frequent Queries", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prom" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 55 - }, - "id": 18, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.1.0", - "targets": [ - { - "editorMode": "code", - "expr": "sum by (query) (\r\n increase(\r\n pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms]\r\n )\r\n *\r\n on(queryid, instance)\r\n group_left(query)\r\n pg_stat_statements_query_id{instance=~\"$Instance\"}\r\n)", - "legendFormat": "__auto", - "range": true, - "refId": "A" - } - ], - "title": "Total Queries Executed", - "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 63 + "y": 96 }, "id": 28, "panels": [], @@ -1955,7 +2531,7 @@ "h": 8, "w": 12, "x": 0, - "y": 64 + "y": 97 }, "id": 35, "maxDataPoints": 100, @@ -2059,7 +2635,7 @@ "h": 8, "w": 12, "x": 12, - "y": 64 + "y": 97 }, "id": 31, "options": { @@ -2184,7 +2760,7 @@ "h": 8, "w": 12, "x": 0, - "y": 72 + "y": 105 }, "id": 30, "options": { @@ -2213,7 +2789,7 @@ "uid": "prom" }, "editorMode": "code", - "expr": "rate(pg_stat_database_xact_commit{instance=\"$instance\",datname=\"$Database\"}[$__interval_ms])", + "expr": "delta(pg_stat_database_xact_commit{instance=\"$instance\",datname=\"$Database\"}[$__interval_ms])", "interval": "", "legendFormat": "committed", "range": true, @@ -2224,10 +2800,12 @@ "type": "prometheus", "uid": "prom" }, - "expr": "rate(pg_stat_database_xact_rollback{instance=\"$Instance\",datname=\"$Database\"}[$__interval_ms])", + "editorMode": "code", + "expr": "delta(pg_stat_database_xact_rollback{instance=\"$Instance\",datname=\"$Database\"}[$__interval_ms])", "hide": false, "interval": "", "legendFormat": "rollback", + "range": true, "refId": "B" } ], @@ -2301,7 +2879,7 @@ "h": 8, "w": 12, "x": 12, - "y": 72 + "y": 105 }, "id": 33, "links": [ @@ -2410,7 +2988,7 @@ "h": 8, "w": 12, "x": 0, - "y": 80 + "y": 113 }, "id": 32, "options": { @@ -2438,9 +3016,11 @@ "type": "prometheus", "uid": "prom" }, - "expr": "rate(pg_stat_database_tup_fetched{instance=\"$Instance\",datname=\"$Database\"}[$__interval_ms])", + "editorMode": "code", + "expr": "delta(pg_stat_database_tup_fetched{instance=\"$Instance\",datname=\"$Database\"}[$__interval_ms])", "interval": "", "legendFormat": "Fetched", + "range": true, "refId": "A" }, { @@ -2448,9 +3028,11 @@ "type": "prometheus", "uid": "prom" }, - "expr": "rate(pg_stat_database_tup_returned{instance=\"$Instance\",datname=\"$Database\"}[$__interval_ms])", + "editorMode": "code", + "expr": "delta(pg_stat_database_tup_returned{instance=\"$Instance\",datname=\"$Database\"}[$__interval_ms])", "interval": "", "legendFormat": "Returned", + "range": true, "refId": "B" } ], @@ -2464,43 +3046,17 @@ }, "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false + "align": "auto", + "cellOptions": { + "type": "auto" }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } + "inspect": false }, + "decimals": 2, + "displayName": "", "mappings": [], + "noValue": "No most called queries", "thresholds": { "mode": "absolute", "steps": [ @@ -2513,42 +3069,273 @@ "value": 80 } ] - } + }, + "unit": "short" }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "queryid" + }, + "properties": [ + { + "id": "displayName", + "value": "Query ID" + }, + { + "id": "custom.align" + }, + { + "id": "unit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Time" + }, + "properties": [ + { + "id": "displayName", + "value": "Time" + }, + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.hidden", + "value": true + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Value" + }, + "properties": [ + { + "id": "displayName", + "value": "Calls/sec" + }, + { + "id": "unit", + "value": "ops" + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "custom.align" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0.97)", + "value": 0 + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 100 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 1000 + }, + { + "value": 10000 + } + ] + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "job" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.hidden", + "value": true + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "tier" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.hidden", + "value": true + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "type" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.hidden", + "value": true + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "query" + }, + "properties": [ + { + "id": "custom.width", + "value": 217 + } + ] + } + ] }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 80 + "y": 113 }, - "id": 36, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" + "id": 46, + "links": [ + { + "url": "/" } + ], + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [ + { + "desc": true, + "displayName": "Query ID" + } + ] }, "pluginVersion": "12.1.0", "targets": [ { + "datasource": { + "type": "prometheus", + "uid": "prom" + }, + "disableTextWrap": false, + "dsType": "influxdb", "editorMode": "code", - "expr": "topk(5,\r\n increase(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n)\r\n*\r\non(queryid, instance)\r\ngroup_left(query)\r\npg_stat_statements_query_id{instance=~\"$Instance\"}", - "legendFormat": "{{query}}", - "range": true, - "refId": "A" + "expr": "(\r\n sort_desc(\r\n topk(\r\n 10,\r\n rate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n or irate(pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}[$__interval_ms])\r\n)\r\n* on (queryid, instance)\r\ngroup_left(query)\r\nmax by (instance, queryid, query) (\r\n pg_stat_statements_query_id{instance=~\"$Instance\"}\r\n)\r\n", + "format": "table", + "fullMetaSearch": false, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, + "includeNullMetadata": true, + "instant": true, + "interval": "$__interval_ms", + "intervalFactor": 1, + "legendFormat": "", + "orderByTime": "ASC", + "policy": "default", + "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [], + "useBackend": false } ], - "title": "Top 5 Most Frequent Queries", - "type": "timeseries" + "title": "Most Called Queries", + "type": "table" }, { "datasource": { @@ -2617,7 +3404,7 @@ "h": 8, "w": 12, "x": 0, - "y": 88 + "y": 121 }, "id": 34, "links": [ @@ -2666,43 +3453,17 @@ }, "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false + "align": "auto", + "cellOptions": { + "type": "auto" }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } + "inspect": false }, + "decimals": 2, + "displayName": "", "mappings": [], + "noValue": "No new slow queries", "thresholds": { "mode": "absolute", "steps": [ @@ -2715,46 +3476,223 @@ "value": 80 } ] - } + }, + "unit": "short" }, - "overrides": [] + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Time" + }, + "properties": [ + { + "id": "displayName", + "value": "Time" + }, + { + "id": "custom.hidden", + "value": true + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "queryid" + }, + "properties": [ + { + "id": "displayName", + "value": "Query ID" + }, + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.align" + }, + { + "id": "unit" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Value" + }, + "properties": [ + { + "id": "displayName", + "value": "Duration" + }, + { + "id": "unit", + "value": "ms" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "query" + }, + "properties": [ + { + "id": "custom.width", + "value": 464 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "instance" + }, + "properties": [ + { + "id": "custom.width", + "value": 61 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "datname" + }, + "properties": [ + { + "id": "custom.width", + "value": 76 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "user" + }, + "properties": [ + { + "id": "custom.width", + "value": 24 + } + ] + } + ] }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 88 + "y": 121 }, - "id": 37, + "id": 47, "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } + "showHeader": true, + "sortBy": [] }, "pluginVersion": "12.1.0", "targets": [ { + "datasource": { + "uid": "Prometheus" + }, "disableTextWrap": false, + "dsType": "influxdb", "editorMode": "code", - "expr": "topk(5,\r\n (\r\n pg_stat_statements_seconds_total{datname=~\"$Database\", instance=~\"$Instance\"}\r\n /\r\n pg_stat_statements_calls_total{datname=~\"$Database\", instance=~\"$Instance\"}\r\n )\r\n)\r\n*\r\non(queryid, instance)\r\ngroup_left(query)\r\npg_stat_statements_query_id{instance=~\"$Instance\"}", + "expr": "(\r\n sort_desc(\r\n topk(\r\n 5,\r\n sum by(queryid, datname, user) (\r\n irate(pg_stat_statements_seconds_total{instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n )\r\n unless (\r\n topk(\r\n 20,\r\n sum by(queryid, datname, user) (\r\n irate(pg_stat_statements_time_milliseconds{instance=~\"$Instance\"}[$__interval_ms])\r\n )\r\n )\r\n )\r\n)\r\n* on (queryid)\r\ngroup_left(instance, query)\r\nmax by (instance, queryid, query) (\r\n pg_stat_statements_query_id{instance=~\"$Instance\"}\r\n)\r\n", + "format": "table", "fullMetaSearch": false, + "groupBy": [ + { + "params": [ + "$__interval" + ], + "type": "time" + }, + { + "params": [ + "null" + ], + "type": "fill" + } + ], + "hide": false, "includeNullMetadata": true, - "legendFormat": "{{datname}} : {{query}}", - "range": true, + "instant": false, + "interval": "$__interval_ms", + "intervalFactor": 1, + "legendFormat": "", + "orderByTime": "ASC", + "policy": "default", "refId": "A", + "resultFormat": "time_series", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "field" + }, + { + "params": [], + "type": "mean" + } + ] + ], + "tags": [], "useBackend": false } ], - "title": "Top 5 Slowest Queries by Average Time by base", - "type": "timeseries" + "title": "New Slow Queries for All Databases", + "type": "table" } ], "preload": false, @@ -2764,11 +3702,12 @@ "list": [ { "current": { - "text": "rc1d-om3s5r3g9xdexbfa.mdb.yandexcloud.net:6432/db1", - "value": "rc1d-om3s5r3g9xdexbfa.mdb.yandexcloud.net:6432/db1" + "text": "cl1c9149bgga4qf10juf-yluz", + "value": "cl1c9149bgga4qf10juf-yluz" }, "definition": "label_values({job=\"integrations/postgres-exporter\"},instance)", "description": "", + "includeAll": false, "name": "Instance", "options": [], "query": { @@ -2783,9 +3722,7 @@ { "current": { "text": "All", - "value": [ - "$__all" - ] + "value": "$__all" }, "definition": "label_values(pg_stat_database_tup_fetched{instance=\"$Instance\"},datname)", "includeAll": true, @@ -2809,7 +3746,7 @@ }, "timepicker": {}, "timezone": "browser", - "title": "PostgreSQL Exporter", - "uid": "46b92f7b-f2f1-49f8-ab31-87bbe5a03f0f", - "version": 7 + "title": "PostgreSQL Exporter Copy of my", + "uid": "77ddcb0e-278f-4e0b-94e5-8b03b208d94d", + "version": 3 } \ No newline at end of file