Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion charts/cluster/templates/monitoring-logical-replication.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.cluster.monitoring.instrumentation.logicalReplication }}
{{- $pgVersion := include "cluster.postgresqlMajor" . | int -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -15,16 +16,20 @@ data:
, s.oid AS subid
, s.subname AS subname
, subenabled AS enabled
{{- if ge $pgVersion 17 }}
, worker_type
{{- end }}
, relid
, pg_wal_lsn_diff(received_lsn, '0/0') AS received_lsn
, last_msg_send_time
, last_msg_receipt_time
, pg_wal_lsn_diff(latest_end_lsn, '0/0') AS latest_end_lsn
, latest_end_time
{{- if ge $pgVersion 15 }}
, apply_error_count
, sync_error_count
, stats_reset
{{- end }}
, ss.pid
, CASE
WHEN received_lsn IS NOT NULL AND latest_end_lsn IS NOT NULL
Expand All @@ -43,7 +48,9 @@ data:
END AS apply_lag_seconds
FROM pg_subscription s
LEFT JOIN pg_stat_subscription ss ON s.oid = ss.subid
LEFT JOIN pg_stat_subscription_stats sss ON s.oid = sss.subid;
{{- if ge $pgVersion 15 }}
LEFT JOIN pg_stat_subscription_stats sss ON s.oid = sss.subid
{{- end }};
target_databases: ["*"]
metrics:
- datname:
Expand All @@ -55,9 +62,11 @@ data:
- subname:
description: Name of the subscription
usage: LABEL
{{- if ge $pgVersion 17 }}
- worker_type:
description: Type of the worker
usage: LABEL
{{- end }}
- relid:
description: OID of the relation
usage: LABEL
Expand All @@ -79,6 +88,7 @@ data:
- enabled:
description: Subscription status (enabled/disabled)
usage: GAUGE
{{- if ge $pgVersion 15 }}
- apply_error_count:
description: Number of times an error occurred while applying changes
usage: GAUGE
Expand All @@ -88,6 +98,7 @@ data:
- stats_reset:
description: Time at which these statistics were last reset
usage: GAUGE
{{- end }}
- pid:
description: Process ID of the subscription worker process
usage: GAUGE
Expand All @@ -101,3 +112,4 @@ data:
description: Seconds since last apply operation
usage: GAUGE
{{- end }}

Loading