Skip to content

Add slot_name to pg_stat_replication #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2016
Merged
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
13 changes: 12 additions & 1 deletion postgres_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ var metricMaps = map[string]map[string]ColumnMapping{
"replay_location": {DISCARD, "Last transaction log position replayed into the database on this standby server", nil},
"sync_priority": {DISCARD, "Priority of this standby server for being chosen as the synchronous standby", nil},
"sync_state": {DISCARD, "Synchronous state of this standby server", nil},
"slot_name": {LABEL, "A unique, cluster-wide identifier for the replication slot", nil},
"plugin": {DISCARD, "The base name of the shared object containing the output plugin this logical slot is using, or null for physical slots", nil},
"slot_type": {DISCARD, "The slot type - physical or logical", nil},
"datoid": {DISCARD, "The OID of the database this slot is associated with, or null. Only logical slots have an associated database", nil},
"database": {DISCARD, "The name of the database this slot is associated with, or null. Only logical slots have an associated database", nil},
"active": {DISCARD, "True if this slot is currently actively being used", nil},
"active_pid": {DISCARD, "Process ID of a WAL sender process", nil},
"xmin": {DISCARD, "The oldest transaction that this slot needs the database to retain. VACUUM cannot remove tuples deleted by any later transaction", nil},
"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},
"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},
"pg_current_xlog_location": {DISCARD, "pg_current_xlog_location", nil},
"pg_xlog_location_diff": {GAUGE, "Lag in bytes between master and slave", nil},
},
Expand All @@ -192,7 +202,8 @@ var queryOverrides = map[string]string{
ON tmp.mode=tmp2.mode and pg_database.oid = tmp2.database ORDER BY 1`,

"pg_stat_replication": `
SELECT *, pg_current_xlog_location(), pg_xlog_location_diff(pg_current_xlog_location(), replay_location)::float FROM pg_stat_replication`,
SELECT *, pg_current_xlog_location(), pg_xlog_location_diff(pg_current_xlog_location(), replay_location)::float FROM pg_stat_replication
INNER JOIN pg_replication_slots ON pg_stat_replication.pid=pg_replication_slots.active_pid`,

"pg_stat_activity": `
SELECT
Expand Down