add source code and readme

This commit is contained in:
2025-12-24 14:35:17 +01:00
parent 7c92e1e610
commit 74324d5a1b
331 changed files with 39272 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
---
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"