{ "annotations": { "list": [ { "builtIn": 1, "datasource": { "type": "datasource", "uid": "grafana" }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "dashboard" } ] }, "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, "links": [], "panels": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Based on last 5m data. > 1 ~ Error. Causes WAL accumulation on the master and possibly autovacuum inefficiencies", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "decimals": 0, "mappings": [ { "options": { "match": "null", "result": { "text": "N/A" } }, "type": "special" } ], "thresholds": { "mode": "absolute", "steps": [ { "color": "#299c46", "value": null }, { "color": "#bf1b00", "value": 1 }, { "color": "#d44a3a", "value": 1000 } ] }, "unit": "none" }, "overrides": [] }, "gridPos": { "h": 2, "w": 3, "x": 0, "y": 0 }, "hideTimeOverride": true, "id": 4, "maxDataPoints": 100, "options": { "colorMode": "background", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "showPercentChange": false, "textMode": "auto", "wideLayout": true }, "pluginVersion": "10.4.1", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "1m" ], "type": "time" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication_slots", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "select sum(\"last\") from (select last(\"non_active_int\") FROM \"replication_slots\" WHERE \"dbname\" =~ /^$dbname$/ AND $timeFilter group by \"dbname\", \"slot_name\")", "rawQuery": true, "rawSql": "SELECT\n 0 as time,\n sum((data->'non_active_int')::int)\nFROM\n replication_slots\nWHERE\n time in (select max(time) from replication_slots where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "active" ], "type": "field" }, { "params": [], "type": "last" } ] ], "tags": [], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "timeFrom": "5m", "title": "Inactive repl. slots", "type": "stat" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Based on last 5m data. FYI - no thresholds defined", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "decimals": 0, "mappings": [ { "options": { "match": "null", "result": { "text": "N/A" } }, "type": "special" } ], "thresholds": { "mode": "absolute", "steps": [ { "color": "#299c46", "value": null }, { "color": "#bf1b00", "value": 1 }, { "color": "#d44a3a", "value": 1000 } ] }, "unit": "none" }, "overrides": [] }, "gridPos": { "h": 2, "w": 3, "x": 3, "y": 0 }, "hideTimeOverride": true, "id": 13, "maxDataPoints": 100, "options": { "colorMode": "none", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "showPercentChange": false, "textMode": "auto", "wideLayout": true }, "pluginVersion": "10.4.1", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "1m" ], "type": "time" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication_slots", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "select count(\"active\") from (select last(\"active\") as \"active\" FROM \"replication_slots\" WHERE \"dbname\" =~ /^$dbname$/ AND $timeFilter group by \"dbname\", \"slot_name\") WHERE \"active\" = true", "rawQuery": true, "rawSql": "SELECT\n 0 as time,\n count(*) filter (where data->>'non_active_int' = '0')\nFROM\n replication_slots\nWHERE\n time in (select max(time) from replication_slots where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "active" ], "type": "field" }, { "params": [], "type": "last" } ] ], "tags": [], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "timeFrom": "5m", "title": "Active repl. slots", "type": "stat" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Data is available only on connected replicas. No thresholds by default", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "decimals": 0, "mappings": [ { "options": { "match": "null", "result": { "text": "N/A" } }, "type": "special" } ], "thresholds": { "mode": "absolute", "steps": [ { "color": "#299c46", "value": null }, { "color": "rgba(237, 129, 40, 0.89)", "value": 100000000 }, { "color": "#d44a3a", "value": 1000000000 } ] }, "unit": "short" }, "overrides": [] }, "gridPos": { "h": 2, "w": 3, "x": 6, "y": 0 }, "hideTimeOverride": true, "id": 14, "maxDataPoints": 100, "options": { "colorMode": "none", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "showPercentChange": false, "textMode": "auto", "wideLayout": true }, "pluginVersion": "10.4.1", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "1d" ], "type": "time" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "select count(\"last\") from (SELECT last(\"state\") FROM \"replication\" WHERE (\"dbname\" =~ /^$dbname$/) AND $timeFilter GROUP BY time(1d), dbname, client_info fill(none)) where \"last\" = 'streaming'", "rawQuery": true, "rawSql": "SELECT\n 0 as time,\n count(*)\nFROM\n replication\nWHERE\n time in (select max(time) from replication where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "replay_lag_b" ], "type": "field" }, { "params": [], "type": "count" } ] ], "tags": [ { "key": "dbname", "operator": "=~", "value": "/^$dbname$/" } ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "timeFrom": "5m", "title": "Active replicas", "type": "stat" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Data is available only on connected replicas. No thresholds by default", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "decimals": 0, "mappings": [ { "options": { "match": "null", "result": { "text": "N/A" } }, "type": "special" } ], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] }, "unit": "short" }, "overrides": [] }, "gridPos": { "h": 2, "w": 3, "x": 9, "y": 0 }, "hideTimeOverride": true, "id": 15, "maxDataPoints": 100, "options": { "colorMode": "none", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "showPercentChange": false, "textMode": "auto", "wideLayout": true }, "pluginVersion": "10.4.1", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "1d" ], "type": "time" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "select sum(\"last\") from (SELECT last(\"is_sync_int\") FROM \"replication\" WHERE (\"dbname\" =~ /^$dbname$/) AND $timeFilter GROUP BY time(1d), dbname, client_info fill(none))", "rawQuery": true, "rawSql": "SELECT\n 0 as time,\n count(*) filter (where data->>'is_sync_int' = '1') \nFROM\n replication\nWHERE\n time in (select max(time) from replication where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "replay_lag_b" ], "type": "field" }, { "params": [], "type": "count" } ] ], "tags": [ { "key": "dbname", "operator": "=~", "value": "/^$dbname$/" } ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "timeFrom": "5m", "title": "Active \"sync\" replicas", "type": "stat" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Based on last 5m of \"pg_replication_slots.restart_lsn\" and translates to \"overhead\" WAL folder size", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "decimals": 1, "mappings": [ { "options": { "match": "null", "result": { "text": "N/A" } }, "type": "special" } ], "thresholds": { "mode": "absolute", "steps": [ { "color": "#299c46", "value": null }, { "color": "rgba(237, 129, 40, 0.89)", "value": 16000000 }, { "color": "#d44a3a", "value": 1000000000 } ] }, "unit": "bytes" }, "overrides": [] }, "gridPos": { "h": 2, "w": 3, "x": 12, "y": 0 }, "hideTimeOverride": true, "id": 7, "maxDataPoints": 100, "options": { "colorMode": "background", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "showPercentChange": false, "textMode": "auto", "wideLayout": true }, "pluginVersion": "10.4.1", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication_slots", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "SELECT max(\"restart_lsn_lag_b\") FROM \"replication_slots\" WHERE \"dbname\" =~ /^$dbname$/ AND $timeFilter GROUP BY time(1d) fill(none)", "rawQuery": true, "rawSql": "SELECT\n 0 as time,\n max((data->'restart_lsn_lag_b')::int8)\nFROM\n replication_slots\nWHERE\n time in (select max(time) from replication_slots where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n\n", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "restart_lsn_lag_b" ], "type": "field" }, { "params": [], "type": "max" } ] ], "tags": [], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "timeFrom": "5m", "title": "Slot max. restart_lsn lag", "type": "stat" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Data is available only on connected replicas! Based on last 5m data.", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "decimals": 1, "mappings": [ { "options": { "match": "null", "result": { "text": "N/A" } }, "type": "special" } ], "thresholds": { "mode": "absolute", "steps": [ { "color": "#299c46", "value": null }, { "color": "rgba(237, 129, 40, 0.89)", "value": 100000000 }, { "color": "#d44a3a", "value": 1000000000 } ] }, "unit": "bytes" }, "overrides": [] }, "gridPos": { "h": 2, "w": 3, "x": 15, "y": 0 }, "hideTimeOverride": true, "id": 6, "maxDataPoints": 100, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "showPercentChange": false, "textMode": "auto", "wideLayout": true }, "pluginVersion": "10.4.1", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "1d" ], "type": "time" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "SELECT max(\"write_lag_b\") FROM \"replication\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": true, "rawSql": "SELECT\n 0 as time,\n max((data->'write_lag_b')::int8)\nFROM\n replication\nWHERE\n time in (select max(time) from replication where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n\n", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "write_lag_b" ], "type": "field" }, { "params": [], "type": "max" } ] ], "tags": [ { "key": "dbname", "operator": "=~", "value": "/^$dbname$/" } ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "timeFrom": "5m", "title": "Max. write lag", "type": "stat" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Data is available only on connected replicas! Based on last 5m data.", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "decimals": 1, "mappings": [ { "options": { "match": "null", "result": { "text": "N/A" } }, "type": "special" } ], "thresholds": { "mode": "absolute", "steps": [ { "color": "#299c46", "value": null }, { "color": "rgba(237, 129, 40, 0.89)", "value": 100000000 }, { "color": "#d44a3a", "value": 1000000000 } ] }, "unit": "bytes" }, "overrides": [] }, "gridPos": { "h": 2, "w": 3, "x": 18, "y": 0 }, "hideTimeOverride": true, "id": 16, "maxDataPoints": 100, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "showPercentChange": false, "textMode": "auto", "wideLayout": true }, "pluginVersion": "10.4.1", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "1d" ], "type": "time" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "SELECT max(\"write_lag_b\") FROM \"replication\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": true, "rawSql": "SELECT\n 0 as time,\n max((data->'flush_lag_b')::int8)\nFROM\n replication\nWHERE\n time in (select max(time) from replication where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n\n", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "flush_lag_b" ], "type": "field" }, { "params": [], "type": "max" } ] ], "tags": [ { "key": "dbname", "operator": "=~", "value": "/^$dbname$/" } ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "timeFrom": "5m", "title": "Max. flush lag", "type": "stat" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Data is available only on connected replicas! Based on last 5m data.", "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "decimals": 1, "mappings": [ { "options": { "match": "null", "result": { "text": "N/A" } }, "type": "special" } ], "thresholds": { "mode": "absolute", "steps": [ { "color": "#299c46", "value": null }, { "color": "rgba(237, 129, 40, 0.89)", "value": 100000000 }, { "color": "#d44a3a", "value": 1000000000 } ] }, "unit": "bytes" }, "overrides": [] }, "gridPos": { "h": 2, "w": 3, "x": 21, "y": 0 }, "hideTimeOverride": true, "id": 9, "maxDataPoints": 100, "options": { "colorMode": "value", "graphMode": "none", "justifyMode": "auto", "orientation": "horizontal", "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "showPercentChange": false, "textMode": "auto", "wideLayout": true }, "pluginVersion": "10.4.1", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "1d" ], "type": "time" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "SELECT max(\"replay_lag_b\") FROM \"replication\" WHERE (\"dbname\" =~ /^$dbname$/) AND $timeFilter GROUP BY time($__interval) fill(none)", "rawQuery": true, "rawSql": "SELECT\n 0 as time,\n max((data->'replay_lag_b')::int8)\nFROM\n replication\nWHERE\n time in (select max(time) from replication where $__timeFilter(time) AND dbname in ($dbname) group by dbname)\n AND dbname in ($dbname)\n\n", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "replay_lag_b" ], "type": "field" }, { "params": [], "type": "max" } ] ], "tags": [ { "key": "dbname", "operator": "=~", "value": "/^$dbname$/" } ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "timeFrom": "5m", "title": "Max. replay lag", "type": "stat" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Based on pg_replication_slots. Primary only", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "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" } }, "mappings": [], "min": 0, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] }, "unit": "bytes" }, "overrides": [] }, "gridPos": { "h": 4, "w": 24, "x": 0, "y": 2 }, "id": 2, "interval": "5m", "options": { "legend": { "calcs": [ "mean" ], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "none" } }, "pluginVersion": "10.4.1", "targets": [ { "alias": "[[tag_dbname]] slot=[[tag_slot_name]]", "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "dbname" ], "type": "tag" }, { "params": [ "slot_name" ], "type": "tag" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication_slots", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "", "rawQuery": true, "rawSql": "SELECT\n $__timeGroup(time, $__interval),\n dbname,\n max((data->'restart_lsn_lag_b')::int8)\nFROM\n replication_slots\nWHERE\n $__timeFilter(time)\n AND dbname in ($dbname)\nGROUP BY 1, 2\nORDER BY 1, 2\n\n", "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "restart_lsn_lag_b" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [ { "key": "dbname", "operator": "=~", "value": "/^$dbname$/" } ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "Replication slot restart_lsn lag (primary extra WAL size)", "type": "timeseries" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Based on pg_stat_replication on primaries. Data is available only on connected replicas!", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "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" } }, "mappings": [], "min": 0, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] }, "unit": "bytes" }, "overrides": [] }, "gridPos": { "h": 4, "w": 24, "x": 0, "y": 6 }, "id": 17, "interval": "2m", "options": { "legend": { "calcs": [ "mean" ], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "none" } }, "pluginVersion": "10.4.1", "targets": [ { "alias": "[[tag_dbname]] [[tag_application_name]] [[tag_client_info]]", "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "dbname" ], "type": "tag" }, { "params": [ "client_info" ], "type": "tag" }, { "params": [ "application_name" ], "type": "tag" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "SELECT mean(\"write_lag_b\") FROM \"replication\" WHERE (\"dbname\" =~ /^$dbname$/) AND $timeFilter GROUP BY time($__interval), \"dbname\", \"client_info\", \"application_name\" fill(none)", "rawQuery": true, "rawSql": "SELECT\n $__timeGroup(time, $__interval),\n dbname,\n avg((data->'flush_lag_b')::int8)\nFROM\n replication\nWHERE\n $__timeFilter(time)\n AND dbname in ($dbname)\nGROUP BY\n 1, 2\nORDER BY\n 1, 2\n \n", "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "flush_lag_b" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [ { "key": "dbname", "operator": "=~", "value": "/^$dbname$/" } ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "Replication flush lag", "type": "timeseries" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Based on pg_stat_replication on primaries. Data is available only on connected replicas!", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "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" } }, "mappings": [], "min": 0, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] }, "unit": "bytes" }, "overrides": [] }, "gridPos": { "h": 4, "w": 24, "x": 0, "y": 10 }, "id": 8, "interval": "15m", "options": { "legend": { "calcs": [ "mean" ], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "none" } }, "pluginVersion": "10.4.1", "targets": [ { "alias": "[[tag_dbname]] [[tag_application_name]] [[tag_client_info]]", "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "dbname" ], "type": "tag" }, { "params": [ "client_info" ], "type": "tag" }, { "params": [ "application_name" ], "type": "tag" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "", "rawQuery": true, "rawSql": "SELECT\n $__timeGroup(time, $__interval),\n dbname,\n avg((data->'replay_lag_b')::int8)\nFROM\n replication\nWHERE\n $__timeFilter(time)\n AND dbname in ($dbname)\nGROUP BY\n 1, 2\nORDER BY\n 1, 2\n \n", "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "replay_lag_b" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [ { "key": "dbname", "operator": "=~", "value": "/^$dbname$/" } ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "Replication replay lag", "type": "timeseries" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "description": "Based on \"pg_replication_slots.xmin\". The oldest transaction that this slot needs the database to retain. VACUUM cannot remove tuples deleted by any later transaction.", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { "axisBorderShow": false, "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "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" } }, "mappings": [], "min": 0, "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] }, "unit": "short" }, "overrides": [] }, "gridPos": { "h": 4, "w": 24, "x": 0, "y": 14 }, "id": 10, "interval": "5m", "options": { "legend": { "calcs": [ "mean" ], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "multi", "sort": "none" } }, "pluginVersion": "10.4.1", "targets": [ { "alias": "[[tag_dbname]] [[tag_slot_name]]", "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "format": "time_series", "group": [], "groupBy": [ { "params": [ "$__interval" ], "type": "time" }, { "params": [ "dbname" ], "type": "tag" }, { "params": [ "plugin" ], "type": "tag" }, { "params": [ "slot_name" ], "type": "tag" }, { "params": [ "none" ], "type": "fill" } ], "measurement": "replication_slots", "metricColumn": "none", "orderByTime": "ASC", "policy": "default", "query": "", "rawQuery": true, "rawSql": "SELECT\n $__timeGroup(time, $__interval),\n dbname,\n avg((data->'xmin_age_tx')::int8)\nFROM\n replication_slots\nWHERE\n $__timeFilter(time)\n AND dbname in ($dbname)\nGROUP BY 1, 2\nORDER BY 1, 2", "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "xmin_age_tx" ], "type": "field" }, { "params": [], "type": "mean" } ] ], "tags": [ { "key": "dbname", "operator": "=~", "value": "/^$dbname$/" } ], "timeColumn": "time", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "Repl. slot XMIN age (in transactions)", "type": "timeseries" }, { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "gridPos": { "h": 4, "w": 24, "x": 0, "y": 18 }, "id": 12, "options": { "code": { "language": "plaintext", "showLineNumbers": false, "showMiniMap": false }, "content": "

Brought to you by

\"Cybertec
", "mode": "html" }, "pluginVersion": "10.4.1", "targets": [ { "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "refId": "A" } ], "transparent": true, "type": "text" } ], "refresh": false, "schemaVersion": 39, "tags": [ "pgwatch" ], "templating": { "list": [ { "current": { "selected": true, "text": [ "All" ], "value": [ "$__all" ] }, "datasource": { "type": "grafana-postgresql-datasource", "uid": "pgwatch-metrics" }, "definition": "", "hide": 0, "includeAll": true, "multi": true, "name": "dbname", "options": [], "query": "SELECT DISTINCT dbname FROM admin.all_distinct_dbname_metrics WHERE metric IN ('replication', 'replication_slots') ORDER BY 1;", "refresh": 1, "regex": "", "skipUrlSync": false, "sort": 0, "tagValuesQuery": "", "tagsQuery": "", "type": "query", "useTags": false } ] }, "time": { "from": "now-3h", "to": "now" }, "timepicker": { "refresh_intervals": [ "5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d" ], "time_options": [ "5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d" ] }, "timezone": "browser", "title": "Replication", "uid": "replication", "version": 1, "weekStart": "" }