Skip to content

Commit 935ca79

Browse files
authored
Merge pull request #23 from mcanevet/slot_name
Add slot_name to pg_stat_replication
2 parents 28cb683 + 83bf784 commit 935ca79

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

postgres_exporter.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ var metricMaps = map[string]map[string]ColumnMapping{
168168
"replay_location": {DISCARD, "Last transaction log position replayed into the database on this standby server", nil},
169169
"sync_priority": {DISCARD, "Priority of this standby server for being chosen as the synchronous standby", nil},
170170
"sync_state": {DISCARD, "Synchronous state of this standby server", nil},
171+
"slot_name": {LABEL, "A unique, cluster-wide identifier for the replication slot", nil},
172+
"plugin": {DISCARD, "The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots", nil},
173+
"slot_type": {DISCARD, "The slot type - physical or logical", nil},
174+
"datoid": {DISCARD, "The OID of the database this slot is associated with, or null. Only logical slots have an associated database", nil},
175+
"database": {DISCARD, "The name of the database this slot is associated with, or null. Only logical slots have an associated database", nil},
176+
"active": {DISCARD, "True if this slot is currently actively being used", nil},
177+
"active_pid": {DISCARD, "Process ID of a WAL sender process", nil},
178+
"xmin": {DISCARD, "The oldest transaction that this slot needs the database to retain. VACUUM cannot remove tuples deleted by any later transaction", nil},
179+
"catalog_xmin": {DISCARD, "The oldest transaction affecting the system catalogs that this slot needs the database to retain. VACUUM cannot remove catalog tuples deleted by any later transaction", nil},
180+
"restart_lsn": {DISCARD, "The address (LSN) of oldest WAL which still might be required by the consumer of this slot and thus won't be automatically removed during checkpoints", nil},
171181
"pg_current_xlog_location": {DISCARD, "pg_current_xlog_location", nil},
172182
"pg_xlog_location_diff": {GAUGE, "Lag in bytes between master and slave", nil},
173183
},
@@ -192,7 +202,8 @@ var queryOverrides = map[string]string{
192202
ON tmp.mode=tmp2.mode and pg_database.oid = tmp2.database ORDER BY 1`,
193203

194204
"pg_stat_replication": `
195-
SELECT *, pg_current_xlog_location(), pg_xlog_location_diff(pg_current_xlog_location(), replay_location)::float FROM pg_stat_replication`,
205+
SELECT *, pg_current_xlog_location(), pg_xlog_location_diff(pg_current_xlog_location(), replay_location)::float FROM pg_stat_replication
206+
INNER JOIN pg_replication_slots ON pg_stat_replication.pid=pg_replication_slots.active_pid`,
196207

197208
"pg_stat_activity": `
198209
SELECT

0 commit comments

Comments
 (0)