Files
Keybard-Vagabond-Demo/manifests/infrastructure/postgresql/postgresql-dashboard-metrics.yaml
Michael DiLeo 7327d77dcd redaction (#1)
Add the redacted source file for demo purposes

Reviewed-on: https://source.michaeldileo.org/michael_dileo/Keybard-Vagabond-Demo/pulls/1
Co-authored-by: Michael DiLeo <michael_dileo@proton.me>
Co-committed-by: Michael DiLeo <michael_dileo@proton.me>
2025-12-24 13:40:47 +00:00

34 lines
1.0 KiB
YAML

---
apiVersion: v1
kind: ConfigMap
metadata:
name: postgresql-dashboard-metrics
namespace: postgresql-system
labels:
app: postgresql-shared
cnpg.io/reload: ""
data:
queries: |
# Simple replication lag metric
pg_replication_lag_seconds:
query: |
SELECT
pg_stat_replication.application_name,
pg_stat_replication.client_addr,
pg_stat_replication.state,
COALESCE(EXTRACT(EPOCH FROM (now() - pg_stat_activity.query_start)), 0) AS lag_seconds
FROM pg_stat_replication
LEFT JOIN pg_stat_activity ON pg_stat_replication.pid = pg_stat_activity.pid
metrics:
- application_name:
usage: "LABEL"
description: "Application name of the standby"
- client_addr:
usage: "LABEL"
description: "IP address of the standby server"
- state:
usage: "LABEL"
description: "Current WAL sender state"
- lag_seconds:
usage: "GAUGE"
description: "Replication lag in seconds"