diff --git a/lib/charms/data_platform_libs/v0/upgrade.py b/lib/charms/data_platform_libs/v0/upgrade.py
index 670f4652e5..4ee2e9ff88 100644
--- a/lib/charms/data_platform_libs/v0/upgrade.py
+++ b/lib/charms/data_platform_libs/v0/upgrade.py
@@ -263,7 +263,7 @@ def restart(self, event) -> None:
import json
import logging
from abc import ABC, abstractmethod
-from typing import List, Literal, Optional, Set, Tuple
+from typing import Dict, List, Literal, Optional, Set, Tuple
import poetry.core.constraints.version as poetry_version
from ops.charm import (
@@ -285,7 +285,7 @@ def restart(self, event) -> None:
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
-LIBPATCH = 14
+LIBPATCH = 15
PYDEPS = ["pydantic>=1.10,<2", "poetry-core"]
@@ -346,7 +346,7 @@ class KafkaDependenciesModel(BaseModel):
print(model.dict()) # exporting back validated deps
"""
- dependencies: dict[str, str]
+ dependencies: Dict[str, str]
name: str
upgrade_supported: str
version: str
diff --git a/src/charm.py b/src/charm.py
index 87a4ea40e7..e4d856ecf7 100755
--- a/src/charm.py
+++ b/src/charm.py
@@ -144,12 +144,27 @@ def __init__(self, *args):
self._observer.start_observer()
self._grafana_agent = COSAgentProvider(
self,
- metrics_endpoints=[
- {"path": "/metrics", "port": METRICS_PORT},
+ metrics_endpoints=[{"path": "/metrics", "port": METRICS_PORT}],
+ scrape_configs=self.patroni_scrape_config,
+ refresh_events=[
+ self.on[PEER].relation_changed,
+ self.on.secret_changed,
+ self.on.secret_remove,
],
log_slots=[f"{POSTGRESQL_SNAP_NAME}:logs"],
)
+ def patroni_scrape_config(self) -> List[Dict]:
+ """Generates scrape config for the Patroni metrics endpoint."""
+ return [
+ {
+ "metrics_path": "/metrics",
+ "static_configs": [{"targets": [f"{self._unit_ip}:8008"]}],
+ "tls_config": {"insecure_skip_verify": True},
+ "scheme": "https" if self.is_tls_enabled else "http",
+ }
+ ]
+
@property
def app_units(self) -> set[Unit]:
"""The peer-related units in the application."""
diff --git a/src/grafana_dashboards/postgresql-patroni-metrics.json b/src/grafana_dashboards/postgresql-patroni-metrics.json
new file mode 100644
index 0000000000..344781d739
--- /dev/null
+++ b/src/grafana_dashboards/postgresql-patroni-metrics.json
@@ -0,0 +1,3337 @@
+{
+ "__inputs": [],
+ "__elements": {},
+ "__requires": [
+ {
+ "type": "grafana",
+ "id": "grafana",
+ "name": "Grafana",
+ "version": "9.2.13"
+ },
+ {
+ "type": "panel",
+ "id": "graph",
+ "name": "Graph (old)",
+ "version": ""
+ },
+ {
+ "type": "datasource",
+ "id": "prometheus",
+ "name": "Prometheus",
+ "version": "1.0.0"
+ },
+ {
+ "type": "panel",
+ "id": "stat",
+ "name": "Stat",
+ "version": ""
+ },
+ {
+ "type": "panel",
+ "id": "text",
+ "name": "Text",
+ "version": ""
+ }
+ ],
+ "description": "Patroni dashboard for use with Percona Monitoring and Management version 2.",
+ "editable": true,
+ "fiscalYearStartMonth": 0,
+ "graphTooltip": 1,
+ "id": null,
+ "liveNow": false,
+ "panels": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 24,
+ "x": 0,
+ "y": 0
+ },
+ "id": 30,
+ "links": [],
+ "options": {
+ "code": {
+ "language": "plaintext",
+ "showLineNumbers": false,
+ "showMiniMap": false
+ },
+ "content": "
Data for $service_name with $interval resolution
",
+ "mode": "html"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "refId": "A"
+ }
+ ],
+ "type": "text"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "Reports Patroni version number.",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "mappings": [
+ {
+ "options": {
+ "0": {
+ "text": "NO"
+ },
+ "1": {
+ "text": "YES"
+ }
+ },
+ "type": "value"
+ },
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "#d44a3a",
+ "value": null
+ },
+ {
+ "color": "rgba(237, 129, 40, 0.89)",
+ "value": 0
+ },
+ {
+ "color": "#299c46",
+ "value": 1
+ }
+ ]
+ },
+ "unit": "none"
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 0,
+ "y": 3
+ },
+ "id": 63,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "none",
+ "graphMode": "none",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "expr": "patroni_version{service_name=~\"$service_name\",scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "{{service_name}}",
+ "range": true,
+ "refId": "A"
+ }
+ ],
+ "title": "Patroni Version",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "decimals": 0,
+ "mappings": [
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "index": 0,
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "text",
+ "value": null
+ }
+ ]
+ },
+ "unit": "dateTimeFromNow"
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 4,
+ "y": 3
+ },
+ "id": 1012,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "area",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_dcs_last_seen{service_name=~\"$service_name\",scope=~\"$scope_name\"}*1000",
+ "format": "time_series",
+ "instant": true,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "",
+ "refId": "A"
+ }
+ ],
+ "title": "Patroni DCS Last Seen",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "decimals": 0,
+ "mappings": [
+ {
+ "options": {
+ "0": {
+ "color": "text",
+ "index": 1,
+ "text": "No"
+ },
+ "1": {
+ "color": "text",
+ "index": 2,
+ "text": "Yes"
+ }
+ },
+ "type": "value"
+ },
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "index": 0,
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "#d44a3a",
+ "value": null
+ }
+ ]
+ },
+ "unit": "none"
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 8,
+ "y": 3
+ },
+ "id": 1005,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "area",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_primary{service_name=~\"$service_name\",scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "instant": true,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "",
+ "refId": "A"
+ }
+ ],
+ "title": "Patroni Leader",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "decimals": 0,
+ "mappings": [
+ {
+ "options": {
+ "0": {
+ "color": "text",
+ "index": 1,
+ "text": "No"
+ },
+ "1": {
+ "color": "text",
+ "index": 2,
+ "text": "Yes"
+ }
+ },
+ "type": "value"
+ },
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "index": 0,
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "#d44a3a",
+ "value": null
+ }
+ ]
+ },
+ "unit": "none"
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 12,
+ "y": 3
+ },
+ "id": 1007,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "area",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_replica{service_name=~\"$service_name\",scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "instant": true,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "",
+ "refId": "A"
+ }
+ ],
+ "title": "Patroni Replica",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "decimals": 0,
+ "mappings": [
+ {
+ "options": {
+ "0": {
+ "color": "text",
+ "index": 1,
+ "text": "No"
+ },
+ "1": {
+ "color": "text",
+ "index": 2,
+ "text": "Yes"
+ }
+ },
+ "type": "value"
+ },
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "index": 0,
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "#d44a3a",
+ "value": null
+ }
+ ]
+ },
+ "unit": "none"
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 16,
+ "y": 3
+ },
+ "id": 1006,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "area",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_standby_leader{service_name=~\"$service_name\",scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "instant": true,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "",
+ "refId": "A"
+ }
+ ],
+ "title": "Patroni Standby Leader",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "decimals": 0,
+ "mappings": [
+ {
+ "options": {
+ "0": {
+ "color": "text",
+ "index": 1,
+ "text": "Enabled"
+ },
+ "1": {
+ "color": "text",
+ "index": 2,
+ "text": "Disabled"
+ }
+ },
+ "type": "value"
+ },
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "index": 0,
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "#d44a3a",
+ "value": null
+ }
+ ]
+ },
+ "unit": "none"
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 20,
+ "y": 3
+ },
+ "id": 1014,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "area",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_is_paused{service_name=~\"$service_name\",scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "instant": true,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "",
+ "refId": "A"
+ }
+ ],
+ "title": "Patroni Autofailover",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "Reports Patroni version number.",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "mappings": [
+ {
+ "options": {
+ "0": {
+ "text": "NO"
+ },
+ "1": {
+ "text": "YES"
+ }
+ },
+ "type": "value"
+ },
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "#d44a3a",
+ "value": null
+ },
+ {
+ "color": "rgba(237, 129, 40, 0.89)",
+ "value": 0
+ },
+ {
+ "color": "#299c46",
+ "value": 1
+ }
+ ]
+ },
+ "unit": "none"
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 0,
+ "y": 6
+ },
+ "id": 1010,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "none",
+ "graphMode": "none",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "expr": "patroni_postgres_server_version{service_name=~\"$service_name\",scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "{{service_name}}",
+ "range": true,
+ "refId": "A"
+ }
+ ],
+ "title": "PostgreSQL Version",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "decimals": 0,
+ "mappings": [
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "index": 0,
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "text",
+ "value": null
+ }
+ ]
+ },
+ "unit": "dateTimeFromNow"
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 4,
+ "y": 6
+ },
+ "id": 1009,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "area",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_postmaster_start_time{service_name=~\"$service_name\",scope=~\"$scope_name\"}*1000",
+ "format": "time_series",
+ "instant": true,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "",
+ "refId": "A"
+ }
+ ],
+ "title": "PostgreSQL Uptime",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "decimals": 0,
+ "mappings": [
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "index": 0,
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "text",
+ "value": null
+ }
+ ]
+ },
+ "unit": "none"
+ },
+ "overrides": [
+ {
+ "matcher": {
+ "id": "byRegexp",
+ "options": "patroni_postgres_running.*"
+ },
+ "properties": [
+ {
+ "id": "mappings",
+ "value": [
+ {
+ "options": {
+ "0": {
+ "color": "dark-red",
+ "index": 0,
+ "text": "No"
+ },
+ "1": {
+ "color": "dark-green",
+ "index": 1,
+ "text": "Yes"
+ }
+ },
+ "type": "value"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 8,
+ "y": 6
+ },
+ "id": 86,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "area",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_postgres_running{service_name=~\"$service_name\",scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "instant": true,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "",
+ "refId": "A"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_postgres_timeline{service_name=~\"$service_name\",scope=~\"$scope_name\"}",
+ "hide": false,
+ "instant": true,
+ "interval": "$interval",
+ "legendFormat": "",
+ "range": false,
+ "refId": "B"
+ }
+ ],
+ "title": "PostgreSQL Running (Timeline)",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "decimals": 0,
+ "mappings": [
+ {
+ "options": {
+ "0": {
+ "color": "dark-green",
+ "index": 1,
+ "text": "No"
+ },
+ "1": {
+ "color": "dark-orange",
+ "index": 2,
+ "text": "Yes"
+ }
+ },
+ "type": "value"
+ },
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "index": 0,
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "#d44a3a",
+ "value": null
+ }
+ ]
+ },
+ "unit": "none"
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 12,
+ "y": 6
+ },
+ "id": 1013,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "area",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_pending_restart{service_name=~\"$service_name\",scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "instant": true,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "",
+ "refId": "A"
+ }
+ ],
+ "title": "PostgreSQL Pending Restart",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "decimals": 0,
+ "mappings": [
+ {
+ "options": {
+ "0": {
+ "color": "dark-green",
+ "index": 1,
+ "text": "Enabled"
+ },
+ "1": {
+ "color": "dark-red",
+ "index": 2,
+ "text": "Paused"
+ }
+ },
+ "type": "value"
+ },
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "index": 0,
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "#d44a3a",
+ "value": null
+ }
+ ]
+ },
+ "unit": "none"
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 16,
+ "y": 6
+ },
+ "id": 1016,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "area",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_xlog_paused{service_name=~\"$service_name\",scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "instant": true,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "",
+ "refId": "A"
+ }
+ ],
+ "title": "PostgreSQL WAL Replay",
+ "type": "stat"
+ },
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "color": {
+ "mode": "thresholds"
+ },
+ "decimals": 0,
+ "mappings": [
+ {
+ "options": {
+ "0": {
+ "color": "text",
+ "index": 1,
+ "text": "No"
+ },
+ "1": {
+ "color": "text",
+ "index": 2,
+ "text": "Yes"
+ }
+ },
+ "type": "value"
+ },
+ {
+ "options": {
+ "match": "null",
+ "result": {
+ "index": 0,
+ "text": "N/A"
+ }
+ },
+ "type": "special"
+ }
+ ],
+ "thresholds": {
+ "mode": "absolute",
+ "steps": [
+ {
+ "color": "#d44a3a",
+ "value": null
+ }
+ ]
+ },
+ "unit": "none"
+ },
+ "overrides": []
+ },
+ "gridPos": {
+ "h": 3,
+ "w": 4,
+ "x": 20,
+ "y": 6
+ },
+ "id": 1008,
+ "links": [],
+ "maxDataPoints": 100,
+ "options": {
+ "colorMode": "value",
+ "graphMode": "area",
+ "justifyMode": "auto",
+ "orientation": "horizontal",
+ "reduceOptions": {
+ "calcs": [
+ "lastNotNull"
+ ],
+ "fields": "",
+ "values": false
+ },
+ "text": {
+ "valueSize": 20
+ },
+ "textMode": "value"
+ },
+ "pluginVersion": "9.2.13",
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_sync_standby{service_name=~\"$service_name\",scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "instant": true,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "",
+ "refId": "A"
+ }
+ ],
+ "title": "Sync Standby",
+ "type": "stat"
+ },
+ {
+ "collapsed": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "PA58DA793C7250F1B"
+ },
+ "gridPos": {
+ "h": 1,
+ "w": 24,
+ "x": 0,
+ "y": 9
+ },
+ "id": 74,
+ "panels": [],
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "PA58DA793C7250F1B"
+ },
+ "refId": "A"
+ }
+ ],
+ "title": "Patroni",
+ "type": "row"
+ },
+ {
+ "aliasColors": {
+ "Total ": "#bf1b00"
+ },
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "decimals": 0,
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "links": []
+ },
+ "overrides": []
+ },
+ "fill": 0,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 10
+ },
+ "hiddenSeries": false,
+ "id": 23,
+ "legend": {
+ "alignAsTable": true,
+ "avg": false,
+ "current": true,
+ "hideEmpty": true,
+ "hideZero": true,
+ "max": true,
+ "min": true,
+ "show": true,
+ "sort": "avg",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 2,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "9.2.13",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "expr": "patroni_primary{scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "hide": false,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "{{juju_unit}}",
+ "range": true,
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "Patroni Primary Node",
+ "tooltip": {
+ "shared": true,
+ "sort": 5,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:143",
+ "decimals": 0,
+ "format": "none",
+ "logBase": 1,
+ "min": "0",
+ "show": true
+ },
+ {
+ "$$hashKey": "object:144",
+ "format": "short",
+ "logBase": 1,
+ "show": false
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {
+ "Total ": "#bf1b00"
+ },
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "decimals": 0,
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "links": []
+ },
+ "overrides": []
+ },
+ "fill": 0,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 12,
+ "y": 10
+ },
+ "hiddenSeries": false,
+ "id": 1015,
+ "legend": {
+ "alignAsTable": true,
+ "avg": false,
+ "current": true,
+ "hideEmpty": true,
+ "hideZero": true,
+ "max": true,
+ "min": true,
+ "show": true,
+ "sort": "avg",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 2,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "9.2.13",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "expr": "patroni_replica{scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "hide": false,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "{{juju_unit}}",
+ "range": true,
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "Patroni Secondary Nodes",
+ "tooltip": {
+ "shared": true,
+ "sort": 5,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:143",
+ "decimals": 0,
+ "format": "none",
+ "logBase": 1,
+ "min": "0",
+ "show": true
+ },
+ {
+ "$$hashKey": "object:144",
+ "format": "short",
+ "logBase": 1,
+ "show": false
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "collapsed": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "PA58DA793C7250F1B"
+ },
+ "gridPos": {
+ "h": 1,
+ "w": 24,
+ "x": 0,
+ "y": 18
+ },
+ "id": 76,
+ "panels": [],
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "PA58DA793C7250F1B"
+ },
+ "refId": "A"
+ }
+ ],
+ "title": "PostgreSQL",
+ "type": "row"
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "decimals": 2,
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "links": []
+ },
+ "overrides": []
+ },
+ "fill": 2,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 19
+ },
+ "hiddenSeries": false,
+ "id": 36,
+ "legend": {
+ "alignAsTable": true,
+ "avg": false,
+ "current": false,
+ "max": true,
+ "min": true,
+ "show": true,
+ "sort": "avg",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 2,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "9.2.5",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "expr": "patroni_xlog_paused{scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "{{juju_unit}}",
+ "range": true,
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "WAL Replay Paused",
+ "tooltip": {
+ "shared": true,
+ "sort": 5,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:637",
+ "decimals": 2,
+ "format": "short",
+ "logBase": 1,
+ "min": "0",
+ "show": true
+ },
+ {
+ "$$hashKey": "object:638",
+ "format": "short",
+ "logBase": 1,
+ "show": false
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "decimals": 2,
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "links": []
+ },
+ "overrides": []
+ },
+ "fill": 0,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 12,
+ "y": 19
+ },
+ "hiddenSeries": false,
+ "id": 1017,
+ "legend": {
+ "alignAsTable": true,
+ "avg": true,
+ "current": false,
+ "hideEmpty": true,
+ "hideZero": true,
+ "max": true,
+ "min": true,
+ "show": true,
+ "sort": "avg",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 2,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "9.2.5",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_xlog_location{scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "instant": false,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "{{juju_unit}}",
+ "range": true,
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "Primary WAL Location",
+ "tooltip": {
+ "shared": true,
+ "sort": 5,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:637",
+ "decimals": 2,
+ "format": "bytes",
+ "logBase": 1,
+ "min": "0",
+ "show": true
+ },
+ {
+ "$$hashKey": "object:638",
+ "format": "short",
+ "logBase": 1,
+ "show": false
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "decimals": 2,
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "links": []
+ },
+ "overrides": []
+ },
+ "fill": 0,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 0,
+ "y": 27
+ },
+ "hiddenSeries": false,
+ "id": 1018,
+ "legend": {
+ "alignAsTable": true,
+ "avg": true,
+ "current": false,
+ "hideEmpty": true,
+ "hideZero": true,
+ "max": true,
+ "min": true,
+ "show": true,
+ "sort": "avg",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 2,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "9.2.5",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_xlog_received_location{scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "instant": false,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "{{juju_unit}}",
+ "range": true,
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "Replicas Received WAL Location",
+ "tooltip": {
+ "shared": true,
+ "sort": 5,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:637",
+ "decimals": 2,
+ "format": "bytes",
+ "logBase": 1,
+ "min": "0",
+ "show": true
+ },
+ {
+ "$$hashKey": "object:638",
+ "format": "short",
+ "logBase": 1,
+ "show": false
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ },
+ {
+ "aliasColors": {},
+ "bars": false,
+ "dashLength": 10,
+ "dashes": false,
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "decimals": 2,
+ "description": "",
+ "fieldConfig": {
+ "defaults": {
+ "links": []
+ },
+ "overrides": []
+ },
+ "fill": 0,
+ "fillGradient": 0,
+ "gridPos": {
+ "h": 8,
+ "w": 12,
+ "x": 12,
+ "y": 27
+ },
+ "hiddenSeries": false,
+ "id": 1019,
+ "legend": {
+ "alignAsTable": true,
+ "avg": true,
+ "current": false,
+ "hideEmpty": true,
+ "hideZero": true,
+ "max": true,
+ "min": true,
+ "show": true,
+ "sort": "avg",
+ "sortDesc": true,
+ "total": false,
+ "values": true
+ },
+ "lines": true,
+ "linewidth": 2,
+ "links": [],
+ "nullPointMode": "null",
+ "options": {
+ "alertThreshold": true
+ },
+ "percentage": false,
+ "pluginVersion": "9.2.5",
+ "pointradius": 5,
+ "points": false,
+ "renderer": "flot",
+ "seriesOverrides": [],
+ "spaceLength": 10,
+ "stack": false,
+ "steppedLine": false,
+ "targets": [
+ {
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "editorMode": "code",
+ "exemplar": false,
+ "expr": "patroni_xlog_replayed_location{scope=~\"$scope_name\"}",
+ "format": "time_series",
+ "instant": false,
+ "interval": "$interval",
+ "intervalFactor": 1,
+ "legendFormat": "{{juju_unit}}",
+ "range": true,
+ "refId": "A"
+ }
+ ],
+ "thresholds": [],
+ "timeRegions": [],
+ "title": "Replicas Replayed WAL Location",
+ "tooltip": {
+ "shared": true,
+ "sort": 5,
+ "value_type": "individual"
+ },
+ "type": "graph",
+ "xaxis": {
+ "mode": "time",
+ "show": true,
+ "values": []
+ },
+ "yaxes": [
+ {
+ "$$hashKey": "object:637",
+ "decimals": 2,
+ "format": "bytes",
+ "logBase": 1,
+ "min": "0",
+ "show": true
+ },
+ {
+ "$$hashKey": "object:638",
+ "format": "short",
+ "logBase": 1,
+ "show": false
+ }
+ ],
+ "yaxis": {
+ "align": false
+ }
+ }
+ ],
+ "refresh": "1m",
+ "schemaVersion": 37,
+ "style": "dark",
+ "tags": [],
+ "templating": {
+ "list": [
+ {
+ "auto": true,
+ "auto_count": 200,
+ "auto_min": "1s",
+ "current": {
+ "selected": false,
+ "text": "auto",
+ "value": "$__auto_interval_interval"
+ },
+ "hide": 0,
+ "label": "Interval",
+ "name": "interval",
+ "options": [
+ {
+ "selected": true,
+ "text": "auto",
+ "value": "$__auto_interval_interval"
+ },
+ {
+ "selected": false,
+ "text": "1s",
+ "value": "1s"
+ },
+ {
+ "selected": false,
+ "text": "5s",
+ "value": "5s"
+ },
+ {
+ "selected": false,
+ "text": "1m",
+ "value": "1m"
+ },
+ {
+ "selected": false,
+ "text": "5m",
+ "value": "5m"
+ },
+ {
+ "selected": false,
+ "text": "1h",
+ "value": "1h"
+ },
+ {
+ "selected": false,
+ "text": "6h",
+ "value": "6h"
+ },
+ {
+ "selected": false,
+ "text": "1d",
+ "value": "1d"
+ }
+ ],
+ "query": "1s,5s,1m,5m,1h,6h,1d",
+ "refresh": 2,
+ "skipUrlSync": false,
+ "type": "interval"
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "work_mem",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_work_mem_bytes{service_name=~\"$service_name\"})",
+ "refId": "Metrics-work_mem-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "label_values(pg_up{service_name=~\"$service_name\"},node_name)",
+ "hide": 2,
+ "includeAll": false,
+ "label": "Node Name",
+ "multi": false,
+ "name": "node_name",
+ "options": [],
+ "query": {
+ "query": "label_values(pg_up{service_name=~\"$service_name\"},node_name)",
+ "refId": "Metrics-node_name-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "label_values(patroni_version, service_name)",
+ "hide": 0,
+ "includeAll": false,
+ "label": "Service Name",
+ "multi": false,
+ "name": "service_name",
+ "options": [],
+ "query": {
+ "query": "label_values(patroni_version, service_name)",
+ "refId": "StandardVariableQuery"
+ },
+ "refresh": 2,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "version",
+ "options": [],
+ "query": {
+ "query": "label_values(pg_static{service_name=~\"$service_name\"},version)",
+ "refId": "Metrics-version-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 2,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "max_connections",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_max_connections{service_name=~\"$service_name\"})",
+ "refId": "Metrics-max_connections-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "shared_buffers",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_shared_buffers_bytes{service_name=~\"$service_name\"})",
+ "refId": "Metrics-shared_buffers-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "wal_buffers",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_wal_buffers_bytes{service_name=~\"$service_name\"})",
+ "refId": "Metrics-wal_buffers-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "wal_segment_size",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_wal_segment_size_bytes{service_name=~\"$service_name\"})",
+ "refId": "Metrics-wal_segment_size-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "maintenance_work_mem",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_maintenance_work_mem_bytes{service_name=~\"$service_name\"})",
+ "refId": "Metrics-maintenance_work_mem-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "block_size",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_block_size{service_name=~\"$service_name\"})",
+ "refId": "Metrics-block_size-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "checkpoint_segments",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_checkpoint_segments{service_name=~\"$service_name\"})",
+ "refId": "Metrics-checkpoint_segments-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "checkpoint_timeout",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_checkpoint_timeout_seconds{service_name=~\"$service_name\"})",
+ "refId": "Metrics-checkpoint_timeout-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "fsync",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_fsync{service_name=~\"$service_name\"})",
+ "refId": "Metrics-fsync-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "default_statistics_target",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_default_statistics_target{service_name=~\"$service_name\"})",
+ "refId": "Metrics-default_statistics_target-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "seq_page_cost",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_seq_page_cost{service_name=~\"$service_name\"})",
+ "refId": "Metrics-seq_page_cost-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "random_page_cost",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_random_page_cost{service_name=~\"$service_name\"})",
+ "refId": "Metrics-random_page_cost-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "effective_cache_size",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_effective_cache_size_bytes{service_name=~\"$service_name\"})",
+ "refId": "Metrics-effective_cache_size-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "effective_io_concurrency",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_effective_io_concurrency{service_name=~\"$service_name\"})",
+ "refId": "Metrics-effective_io_concurrency-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum_analyze_scale_factor",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum_analyze_scale_factor{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum_analyze_scale_factor-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum_analyze_threshold",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum_analyze_threshold{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum_analyze_threshold-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum_vacuum_scale_factor",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum_vacuum_scale_factor{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum_vacuum_scale_factor-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum_vacuum_threshold",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum_vacuum_threshold{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum_vacuum_threshold-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum_vacuum_cost_limit",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum_vacuum_cost_limit{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum_vacuum_cost_limit-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum_vacuum_cost_delay",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum_vacuum_cost_delay_seconds{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum_vacuum_cost_delay-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum_max_workers",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum_max_workers{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum_max_workers-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum_naptime",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum_naptime_seconds{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum_naptime-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum_freeze_max_age",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum_freeze_max_age{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum_freeze_max_age-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "logging_collector",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_logging_collector{service_name=~\"$service_name\"})",
+ "refId": "Metrics-logging_collector-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "log_min_duration_statement",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_log_min_duration_statement_seconds{service_name=~\"$service_name\"})",
+ "refId": "Metrics-log_min_duration_statement-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "log_duration",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_log_duration{service_name=~\"$service_name\"})",
+ "refId": "Metrics-log_duration-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "log_lock_waits",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_log_lock_waits{service_name=~\"$service_name\"})",
+ "refId": "Metrics-log_lock_waits-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "max_wal_senders",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_max_wal_senders{service_name=~\"$service_name\"})",
+ "refId": "Metrics-max_wal_senders-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "max_wal_size",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_max_wal_size_bytes{service_name=~\"$service_name\"})",
+ "refId": "Metrics-max_wal_size-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "min_wal_size",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_min_wal_size_bytes{service_name=~\"$service_name\"})",
+ "refId": "Metrics-min_wal_size-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "wal_compression",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_wal_compression{service_name=~\"$service_name\"})",
+ "refId": "Metrics-wal_compression-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "max_worker_processes",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_max_worker_processes{service_name=~\"$service_name\"})",
+ "refId": "Metrics-max_worker_processes-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "max_parallel_workers_per_gather",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_max_parallel_workers_per_gather{service_name=~\"$service_name\"})",
+ "refId": "Metrics-max_parallel_workers_per_gather-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "max_parallel_workers",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_max_parallel_workers_per_gather{service_name=~\"$service_name\"})",
+ "refId": "Metrics-max_parallel_workers-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum_work_mem",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum_work_mem_bytes{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum_work_mem-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "",
+ "hide": 2,
+ "includeAll": false,
+ "multi": false,
+ "name": "autovacuum_multixact_freeze_max_age",
+ "options": [],
+ "query": {
+ "query": "query_result(pg_settings_autovacuum_multixact_freeze_max_age{service_name=~\"$service_name\"})",
+ "refId": "Metrics-autovacuum_multixact_freeze_max_age-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "/ ([0-9\\.]+)/",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "allValue": ".*",
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, environment)",
+ "hide": 2,
+ "includeAll": true,
+ "label": "Environment",
+ "multi": true,
+ "name": "environment",
+ "options": [],
+ "query": {
+ "query": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, environment)",
+ "refId": "Metrics-environment-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, cluster)",
+ "hide": 2,
+ "includeAll": true,
+ "label": "Cluster",
+ "multi": true,
+ "name": "cluster",
+ "options": [],
+ "query": {
+ "query": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, cluster)",
+ "refId": "Metrics-cluster-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, replication_set)",
+ "hide": 2,
+ "includeAll": true,
+ "label": "Replication Set",
+ "multi": true,
+ "name": "replication_set",
+ "options": [],
+ "query": {
+ "query": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, replication_set)",
+ "refId": "Metrics-replication_set-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, node_type)",
+ "hide": 2,
+ "includeAll": true,
+ "label": "Type",
+ "multi": true,
+ "name": "node_type",
+ "options": [],
+ "query": {
+ "query": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, node_type)",
+ "refId": "Metrics-node_type-Variable-Query"
+ },
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, service_type)",
+ "hide": 2,
+ "includeAll": true,
+ "label": "Type",
+ "multi": true,
+ "name": "service_type",
+ "options": [],
+ "query": {
+ "query": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, service_type)",
+ "refId": "Metrics-service_type-Variable-Query"
+ },
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "label_values(mysql_info_schema_user_statistics_connected_time_seconds_total{service_name=\"$service_name\"},user)",
+ "hide": 2,
+ "includeAll": true,
+ "label": "Username",
+ "multi": true,
+ "name": "username",
+ "options": [],
+ "query": {
+ "query": "label_values(mysql_info_schema_user_statistics_connected_time_seconds_total{service_name=\"$service_name\"},user)",
+ "refId": "Metrics-username-Variable-Query"
+ },
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, schema)",
+ "hide": 2,
+ "includeAll": true,
+ "label": "Schema",
+ "multi": true,
+ "name": "schema",
+ "options": [],
+ "query": {
+ "query": "label_values({__name__=~\"pg_up|mysql_up|mongodb_up|proxysql_mysql_status_active_transactions\"}, schema)",
+ "refId": "Metrics-schema-Variable-Query"
+ },
+ "refresh": 1,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "label_values(pg_up{service_name=\"$service_name\"}, service_id)",
+ "hide": 2,
+ "includeAll": false,
+ "label": "Service ID",
+ "multi": false,
+ "name": "service_id",
+ "options": [],
+ "query": {
+ "query": "label_values(pg_up{service_name=\"$service_name\"}, service_id)",
+ "refId": "Metrics-service_id-Variable-Query"
+ },
+ "refresh": 2,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ },
+ {
+ "current": {},
+ "datasource": {
+ "type": "datasource",
+ "uid": "${prometheusds}"
+ },
+ "definition": "label_values(patroni_version, scope)",
+ "hide": 0,
+ "includeAll": false,
+ "label": "Scope Name",
+ "multi": false,
+ "name": "scope_name",
+ "options": [],
+ "query": {
+ "query": "label_values(patroni_version, scope)",
+ "refId": "StandardVariableQuery"
+ },
+ "refresh": 2,
+ "regex": "",
+ "skipUrlSync": false,
+ "sort": 5,
+ "tagValuesQuery": "",
+ "tagsQuery": "",
+ "type": "query",
+ "useTags": false
+ }
+ ]
+ },
+ "time": {
+ "from": "now-1h",
+ "to": "now"
+ },
+ "timepicker": {
+ "hidden": false,
+ "refresh_intervals": [
+ "5s",
+ "10s",
+ "30s",
+ "1m",
+ "5m",
+ "15m",
+ "30m",
+ "1h",
+ "2h",
+ "1d"
+ ],
+ "time_options": [
+ "5m",
+ "15m",
+ "1h",
+ "6h",
+ "12h",
+ "24h",
+ "2d",
+ "7d",
+ "30d"
+ ]
+ },
+ "timezone": "",
+ "title": "Patroni",
+ "tags": ["postgres", "patroni"],
+ "uid": "rLzu8z_Vk",
+ "version": 5,
+ "weekStart": "",
+ "gnetId": 18870
+}
diff --git a/tests/integration/ha_tests/test_upgrade.py b/tests/integration/ha_tests/test_upgrade.py
index 2dd8cac653..c58572428f 100644
--- a/tests/integration/ha_tests/test_upgrade.py
+++ b/tests/integration/ha_tests/test_upgrade.py
@@ -47,7 +47,7 @@ async def test_deploy_latest(ops_test: OpsTest) -> None:
logger.info("Wait for applications to become active")
async with ops_test.fast_forward():
await ops_test.model.wait_for_idle(
- apps=[DATABASE_APP_NAME, APPLICATION_NAME], status="active"
+ apps=[DATABASE_APP_NAME, APPLICATION_NAME], status="active", timeout=1000
)
assert len(ops_test.model.applications[DATABASE_APP_NAME].units) == 3
diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py
index 5344dd9ce4..6f61f8f2f6 100644
--- a/tests/unit/test_charm.py
+++ b/tests/unit/test_charm.py
@@ -135,6 +135,37 @@ def test_on_install_snap_failure(
_install_snap_packages.assert_called_once()
self.assertTrue(isinstance(self.harness.model.unit.status, BlockedStatus))
+ @patch_network_get(private_address="1.1.1.1")
+ def test_patroni_scrape_config_no_tls(self):
+ result = self.charm.patroni_scrape_config()
+
+ assert result == [
+ {
+ "metrics_path": "/metrics",
+ "scheme": "http",
+ "static_configs": [{"targets": ["1.1.1.1:8008"]}],
+ "tls_config": {"insecure_skip_verify": True},
+ },
+ ]
+
+ @patch_network_get(private_address="1.1.1.1")
+ @patch(
+ "charm.PostgresqlOperatorCharm.is_tls_enabled",
+ return_value=True,
+ new_callable=PropertyMock,
+ )
+ def test_patroni_scrape_config_tls(self, _):
+ result = self.charm.patroni_scrape_config()
+
+ assert result == [
+ {
+ "metrics_path": "/metrics",
+ "scheme": "https",
+ "static_configs": [{"targets": ["1.1.1.1:8008"]}],
+ "tls_config": {"insecure_skip_verify": True},
+ },
+ ]
+
@patch("charm.PostgresqlOperatorCharm._update_relation_endpoints", new_callable=PropertyMock)
@patch(
"charm.PostgresqlOperatorCharm.primary_endpoint",
@@ -1058,6 +1089,7 @@ def test_restart(self, _are_all_members_ready, _restart_postgresql):
mock_event.defer.assert_not_called()
@patch_network_get(private_address="1.1.1.1")
+ @patch("charm.time.sleep", return_value=None)
@patch("subprocess.check_output", return_value=b"C")
@patch("charm.snap.SnapCache")
@patch("charms.rolling_ops.v0.rollingops.RollingOpsManager._on_acquire_lock")
@@ -1080,6 +1112,7 @@ def test_update_config(
_restart,
___,
____,
+ _____,
):
with patch.object(PostgresqlOperatorCharm, "postgresql", Mock()) as postgresql_mock:
# Mock some properties.
diff --git a/tests/unit/test_upgrade.py b/tests/unit/test_upgrade.py
index dd584f2899..d04c195cd9 100644
--- a/tests/unit/test_upgrade.py
+++ b/tests/unit/test_upgrade.py
@@ -51,6 +51,7 @@ def test_log_rollback(self, mock_logging, _update_config):
)
@patch_network_get(private_address="1.1.1.1")
+ @patch("charm.Patroni.get_postgresql_version")
@patch("charms.data_platform_libs.v0.upgrade.DataUpgrade.on_upgrade_changed")
@patch("charms.data_platform_libs.v0.upgrade.DataUpgrade.set_unit_failed")
@patch("charms.data_platform_libs.v0.upgrade.DataUpgrade.set_unit_completed")
@@ -77,6 +78,7 @@ def test_on_upgrade_granted(
_set_unit_completed,
_set_unit_failed,
_on_upgrade_changed,
+ __,
):
# Test when the charm fails to start Patroni.
mock_event = MagicMock()