{ "annotations": { "list": [ { "builtIn": 1, "datasource": { "type": "datasource", "uid": "grafana" }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "dashboard" } ] }, "description": "Performance metrics for Postgres", "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, "id": 55, "links": [], "panels": [ { "datasource": { "uid": "$datasource" }, "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": true, "stacking": { "group": "A", "mode": "none" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green" }, { "color": "red", "value": 80 } ] }, "unit": "short" }, "overrides": [] }, "gridPos": { "h": 7, "w": 20, "x": 0, "y": 0 }, "id": 1, "options": { "alertThreshold": true, "legend": { "calcs": [ "mean", "max", "min" ], "displayMode": "table", "placement": "right", "showLegend": true }, "tooltip": { "hideZeros": false, "mode": "multi", "sort": "none" } }, "pluginVersion": "11.6.0", "targets": [ { "alias": "fetched", "datasource": { "uid": "$datasource" }, "dsType": "prometheus", "editorMode": "code", "expr": "sum(irate(pg_stat_database_tup_fetched{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval]))", "format": "time_series", "groupBy": [ { "params": [ "$interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "intervalFactor": 2, "legendFormat": "fetched", "measurement": "postgresql", "policy": "default", "range": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "tup_fetched" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "10s" ], "type": "non_negative_derivative" } ] ], "step": 120, "tags": [ { "key": "instance", "operator": "=~", "value": "/^$instance$/" } ] }, { "alias": "fetched", "datasource": { "uid": "$datasource" }, "dsType": "prometheus", "editorMode": "code", "expr": "sum(irate(pg_stat_database_tup_returned{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval]))", "format": "time_series", "groupBy": [ { "params": [ "$interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "intervalFactor": 2, "legendFormat": "returned", "measurement": "postgresql", "policy": "default", "range": true, "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "tup_fetched" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "10s" ], "type": "non_negative_derivative" } ] ], "step": 120, "tags": [ { "key": "instance", "operator": "=~", "value": "/^$instance$/" } ] }, { "alias": "fetched", "datasource": { "uid": "$datasource" }, "dsType": "prometheus", "editorMode": "code", "expr": "sum(irate(pg_stat_database_tup_inserted{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval]))", "format": "time_series", "groupBy": [ { "params": [ "$interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "intervalFactor": 2, "legendFormat": "inserted", "measurement": "postgresql", "policy": "default", "range": true, "refId": "C", "resultFormat": "time_series", "select": [ [ { "params": [ "tup_fetched" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "10s" ], "type": "non_negative_derivative" } ] ], "step": 120, "tags": [ { "key": "instance", "operator": "=~", "value": "/^$instance$/" } ] }, { "alias": "fetched", "datasource": { "uid": "$datasource" }, "dsType": "prometheus", "editorMode": "code", "expr": "sum(irate(pg_stat_database_tup_updated{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval]))", "format": "time_series", "groupBy": [ { "params": [ "$interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "intervalFactor": 2, "legendFormat": "updated", "measurement": "postgresql", "policy": "default", "range": true, "refId": "D", "resultFormat": "time_series", "select": [ [ { "params": [ "tup_fetched" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "10s" ], "type": "non_negative_derivative" } ] ], "step": 120, "tags": [ { "key": "instance", "operator": "=~", "value": "/^$instance$/" } ] }, { "alias": "fetched", "datasource": { "uid": "$datasource" }, "dsType": "prometheus", "editorMode": "code", "expr": "sum(irate(pg_stat_database_tup_deleted{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval]))", "format": "time_series", "groupBy": [ { "params": [ "$interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "intervalFactor": 2, "legendFormat": "deleted", "measurement": "postgresql", "policy": "default", "range": true, "refId": "E", "resultFormat": "time_series", "select": [ [ { "params": [ "tup_fetched" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "10s" ], "type": "non_negative_derivative" } ] ], "step": 120, "tags": [ { "key": "instance", "operator": "=~", "value": "/^$instance$/" } ] } ], "title": "Rows", "type": "timeseries" }, { "datasource": { "uid": "$datasource" }, "fieldConfig": { "defaults": { "color": { "fixedColor": "rgb(31, 120, 193)", "mode": "fixed" }, "decimals": 0, "mappings": [ { "options": { "match": "null", "result": { "text": "N/A" } }, "type": "special" } ], "thresholds": { "mode": "absolute", "steps": [ { "color": "green" }, { "color": "red", "value": 80 } ] }, "unit": "none" }, "overrides": [] }, "gridPos": { "h": 3, "w": 4, "x": 20, "y": 0 }, "id": 11, "maxDataPoints": 100, "options": { "colorMode": "none", "graphMode": "area", "justifyMode": "auto", "orientation": "horizontal", "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ "mean" ], "fields": "", "values": false }, "showPercentChange": false, "textMode": "auto", "wideLayout": true }, "pluginVersion": "11.6.0", "targets": [ { "datasource": { "uid": "$datasource" }, "dsType": "prometheus", "editorMode": "code", "expr": "sum(irate(pg_stat_database_xact_commit{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval])) + sum(irate(pg_stat_database_xact_rollback{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval]))", "format": "time_series", "groupBy": [ { "params": [ "$interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "intervalFactor": 2, "measurement": "postgresql", "policy": "default", "range": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "xact_commit" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [ "10s" ], "type": "non_negative_derivative" } ] ], "step": 1800, "tags": [ { "key": "instance", "operator": "=~", "value": "/^$instance$/" } ] } ], "title": "QPS", "transparent": true, "type": "stat" }, { "datasource": { "uid": "$datasource" }, "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": true, "stacking": { "group": "A", "mode": "none" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], "min": 0, "thresholds": { "mode": "absolute", "steps": [ { "color": "green" }, { "color": "red", "value": 80 } ] }, "unit": "short" }, "overrides": [ { "matcher": { "id": "byValue", "options": { "op": "gte", "reducer": "allIsZero", "value": 0 } }, "properties": [ { "id": "custom.hideFrom", "value": { "legend": true, "tooltip": true, "viz": false } } ] } ] }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 7 }, "id": 2, "options": { "alertThreshold": true, "legend": { "calcs": [ "mean", "max", "min" ], "displayMode": "table", "placement": "bottom", "showLegend": true }, "tooltip": { "hideZeros": false, "mode": "multi", "sort": "none" } }, "pluginVersion": "11.6.0", "targets": [ { "alias": "Buffers Allocated", "datasource": { "uid": "$datasource" }, "dsType": "prometheus", "editorMode": "code", "expr": "irate(pg_stat_bgwriter_buffers_alloc_total{namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval])", "format": "time_series", "groupBy": [ { "params": [ "$interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "intervalFactor": 2, "legendFormat": "{{ namespace}}.{{service}} alloc", "measurement": "postgresql", "policy": "default", "range": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "buffers_alloc" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [], "type": "difference" } ] ], "step": 240, "tags": [ { "key": "instance", "operator": "=~", "value": "/^$instance$/" } ] }, { "alias": "Buffers Allocated", "datasource": { "uid": "$datasource" }, "dsType": "prometheus", "editorMode": "code", "expr": "irate(pg_stat_bgwriter_buffers_clean_total{namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval])", "format": "time_series", "groupBy": [ { "params": [ "$interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "intervalFactor": 2, "legendFormat": "{{ namespace}}.{{service}} clean", "measurement": "postgresql", "policy": "default", "range": true, "refId": "D", "resultFormat": "time_series", "select": [ [ { "params": [ "buffers_alloc" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [], "type": "difference" } ] ], "step": 240, "tags": [ { "key": "instance", "operator": "=~", "value": "/^$instance$/" } ] } ], "title": "Buffers", "type": "timeseries" }, { "datasource": { "uid": "$datasource" }, "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": 2, "pointSize": 5, "scaleDistribution": { "type": "linear" }, "showPoints": "never", "spanNulls": true, "stacking": { "group": "A", "mode": "none" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], "min": 0, "thresholds": { "mode": "absolute", "steps": [ { "color": "green" }, { "color": "red", "value": 80 } ] }, "unit": "short" }, "overrides": [] }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 7 }, "id": 3, "options": { "alertThreshold": true, "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "hideZeros": false, "mode": "multi", "sort": "none" } }, "pluginVersion": "11.6.0", "targets": [ { "alias": "conflicts", "datasource": { "uid": "$datasource" }, "dsType": "prometheus", "editorMode": "code", "expr": "sum(rate(pg_stat_database_deadlocks{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval]))", "format": "time_series", "groupBy": [ { "params": [ "$interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "intervalFactor": 2, "legendFormat": "deadlocks", "measurement": "postgresql", "policy": "default", "range": true, "refId": "A", "resultFormat": "time_series", "select": [ [ { "params": [ "conflicts" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [], "type": "difference" } ] ], "step": 240, "tags": [ { "key": "instance", "operator": "=~", "value": "/^$instance$/" } ] }, { "alias": "deadlocks", "datasource": { "uid": "$datasource" }, "dsType": "prometheus", "editorMode": "code", "expr": "sum(rate(pg_stat_database_conflicts{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval]))", "format": "time_series", "groupBy": [ { "params": [ "$interval" ], "type": "time" }, { "params": [ "null" ], "type": "fill" } ], "intervalFactor": 2, "legendFormat": "conflicts", "measurement": "postgresql", "policy": "default", "range": true, "refId": "B", "resultFormat": "time_series", "select": [ [ { "params": [ "deadlocks" ], "type": "field" }, { "params": [], "type": "mean" }, { "params": [], "type": "difference" } ] ], "step": 240, "tags": [ { "key": "instance", "operator": "=~", "value": "/^$instance$/" } ] } ], "title": "Conflicts/Deadlocks", "type": "timeseries" }, { "datasource": { "uid": "$datasource" }, "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": 2, "pointSize": 5, "scaleDistribution": { "type": "linear" }, "showPoints": "never", "spanNulls": true, "stacking": { "group": "A", "mode": "none" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green" }, { "color": "red", "value": 80 } ] }, "unit": "percentunit" }, "overrides": [] }, "gridPos": { "h": 7, "w": 12, "x": 0, "y": 14 }, "id": 12, "options": { "alertThreshold": true, "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "hideZeros": false, "mode": "multi", "sort": "none" } }, "pluginVersion": "11.6.0", "targets": [ { "datasource": { "uid": "$datasource" }, "editorMode": "code", "expr": "sum by (datname) (rate(pg_stat_database_blks_hit{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval])) / (sum by (datname)(rate(pg_stat_database_blks_hit{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval])) + sum by (datname)(rate(pg_stat_database_blks_read{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}[$__rate_interval])))", "format": "time_series", "intervalFactor": 2, "legendFormat": "{{datname}} - cache hit rate", "range": true, "refId": "A", "step": 240 } ], "title": "Cache hit ratio (by DBName)", "type": "timeseries" }, { "datasource": { "uid": "$datasource" }, "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": 2, "pointSize": 5, "scaleDistribution": { "type": "linear" }, "showPoints": "never", "spanNulls": true, "stacking": { "group": "A", "mode": "none" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green" }, { "color": "red", "value": 80 } ] }, "unit": "short" }, "overrides": [] }, "gridPos": { "h": 7, "w": 12, "x": 12, "y": 14 }, "id": 13, "options": { "alertThreshold": true, "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "hideZeros": false, "mode": "multi", "sort": "none" } }, "pluginVersion": "11.6.0", "targets": [ { "datasource": { "uid": "$datasource" }, "editorMode": "code", "expr": "pg_stat_database_numbackends{datname=~\"$db\",namespace=~\"$namespace\",service=~\"$service\"}", "format": "time_series", "intervalFactor": 2, "legendFormat": "{{datname}} - {{__name__}}", "range": true, "refId": "A", "step": 240 } ], "title": "Number of active connections", "type": "timeseries" } ], "preload": false, "refresh": "5s", "schemaVersion": 41, "tags": [ "postgres" ], "templating": { "list": [ { "current": { "text": "Prometheus", "value": "prometheus" }, "includeAll": false, "label": "Data Source", "name": "datasource", "options": [], "query": "prometheus", "refresh": 1, "regex": "", "type": "datasource" }, { "allValue": ".+", "current": { "text": "All", "value": [ "$__all" ] }, "datasource": "$datasource", "definition": "label_values(pg_up,namespace)", "includeAll": true, "label": "Namespace", "multi": true, "name": "namespace", "options": [], "query": { "qryType": 1, "query": "label_values(pg_up,namespace)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, "regex": "", "type": "query" }, { "allValue": ".+", "current": { "text": "All", "value": "$__all" }, "datasource": "$datasource", "definition": "label_values(up{namespace=~\"$namespace\"},service)", "description": "", "includeAll": true, "label": "Service", "multi": true, "name": "service", "options": [], "query": { "qryType": 1, "query": "label_values(up{namespace=~\"$namespace\"},service)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, "regex": "", "type": "query" }, { "allValue": ".+", "current": { "text": "All", "value": "$__all" }, "datasource": "$datasource", "definition": "label_values(pg_stat_database_tup_fetched{namespace=~\"$namespace\", datname!~\"template.*|postgres\", service=~\"$service\"},datname)", "includeAll": true, "label": "db", "name": "db", "options": [], "query": { "qryType": 1, "query": "label_values(pg_stat_database_tup_fetched{namespace=~\"$namespace\", datname!~\"template.*|postgres\", service=~\"$service\"},datname)", "refId": "PrometheusVariableQueryEditor-VariableQuery" }, "refresh": 1, "regex": "", "type": "query" } ] }, "time": { "from": "now-15m", "to": "now" }, "timepicker": {}, "timezone": "browser", "title": "Postgres Overview", "uid": "wGgaPlciz", "version": 1 }