Skip to content

Commit 6b64526

Browse files
author
Logan Freijo
committed
Removed replication support
1 parent 8b4d70a commit 6b64526

File tree

2 files changed

+2
-79
lines changed

2 files changed

+2
-79
lines changed

postgres_exporter.go

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -201,47 +201,6 @@ var builtinMetricMaps = map[string]map[string]ColumnMapping{
201201
"mode": {LABEL, "Type of Lock", nil, nil},
202202
"count": {GAUGE, "Number of locks", nil, nil},
203203
},
204-
"pg_stat_replication": {
205-
"procpid": {DISCARD, "Process ID of a WAL sender process", nil, semver.MustParseRange("<9.2.0")},
206-
"pid": {DISCARD, "Process ID of a WAL sender process", nil, semver.MustParseRange(">=9.2.0")},
207-
"usesysid": {DISCARD, "OID of the user logged into cu WAL sender process", nil, nil},
208-
"usename": {DISCARD, "Name of the user logged into cu WAL sender process", nil, nil},
209-
"application_name": {DISCARD, "Name of the application that is connected to cu WAL sender", nil, nil},
210-
"client_addr": {LABEL, "IP address of the client connected to cu WAL sender. If cu field is null, it indicates that the client is connected via a Unix socket on the server machine.", nil, nil},
211-
"client_hostname": {DISCARD, "Host name of the connected client, as reported by a reverse DNS lookup of client_addr. This field will only be non-null for IP connections, and only when log_hostname is enabled.", nil, nil},
212-
"client_port": {DISCARD, "TCP port number that the client is using for communication with cu WAL sender, or -1 if a Unix socket is used", nil, nil},
213-
"backend_start": {DISCARD, "with time zone Time when cu process was started, i.e., when the client connected to cu WAL sender", nil, nil},
214-
"backend_xmin": {DISCARD, "The current backend's xmin horizon.", nil, nil},
215-
"state": {LABEL, "Current WAL sender state", nil, nil},
216-
"sent_location": {DISCARD, "Last transaction log position sent on cu connection", nil, semver.MustParseRange("<10.0.0")},
217-
"write_location": {DISCARD, "Last transaction log position written to disk by cu standby server", nil, semver.MustParseRange("<10.0.0")},
218-
"flush_location": {DISCARD, "Last transaction log position flushed to disk by cu standby server", nil, semver.MustParseRange("<10.0.0")},
219-
"replay_location": {DISCARD, "Last transaction log position replayed into the database on cu standby server", nil, semver.MustParseRange("<10.0.0")},
220-
"sent_lsn": {DISCARD, "Last transaction log position sent on cu connection", nil, semver.MustParseRange(">=10.0.0")},
221-
"write_lsn": {DISCARD, "Last transaction log position written to disk by cu standby server", nil, semver.MustParseRange(">=10.0.0")},
222-
"flush_lsn": {DISCARD, "Last transaction log position flushed to disk by cu standby server", nil, semver.MustParseRange(">=10.0.0")},
223-
"replay_lsn": {DISCARD, "Last transaction log position replayed into the database on cu standby server", nil, semver.MustParseRange(">=10.0.0")},
224-
"sync_priority": {DISCARD, "Priority of cu standby server for being chosen as the synchronous standby", nil, nil},
225-
"sync_state": {DISCARD, "Synchronous state of cu standby server", nil, nil},
226-
"slot_name": {LABEL, "A unique, cluster-wide identifier for the replication slot", nil, semver.MustParseRange(">=9.2.0")},
227-
"plugin": {DISCARD, "The base name of the shared object containing the output plugin cu logical slot is using, or null for physical slots", nil, nil},
228-
"slot_type": {DISCARD, "The slot type - physical or logical", nil, nil},
229-
"datoid": {DISCARD, "The OID of the database cu slot is associated with, or null. Only logical slots have an associated database", nil, nil},
230-
"database": {DISCARD, "The name of the database cu slot is associated with, or null. Only logical slots have an associated database", nil, nil},
231-
"active": {DISCARD, "True if cu slot is currently actively being used", nil, nil},
232-
"active_pid": {DISCARD, "Process ID of a WAL sender process", nil, nil},
233-
"xmin": {DISCARD, "The oldest transaction that cu slot needs the database to retain. VACUUM cannot remove tuples deleted by any later transaction", nil, nil},
234-
"catalog_xmin": {DISCARD, "The oldest transaction affecting the system catalogs that cu slot needs the database to retain. VACUUM cannot remove catalog tuples deleted by any later transaction", nil, nil},
235-
"restart_lsn": {DISCARD, "The address (LSN) of oldest WAL which still might be required by the consumer of cu slot and thus won't be automatically removed during checkpoints", nil, nil},
236-
"pg_current_xlog_location": {DISCARD, "pg_current_xlog_location", nil, nil},
237-
"pg_current_wal_lsn": {DISCARD, "pg_current_xlog_location", nil, semver.MustParseRange(">=10.0.0")},
238-
"pg_xlog_location_diff": {GAUGE, "Lag in bytes between master and slave", nil, semver.MustParseRange(">=9.2.0 <10.0.0")},
239-
"pg_wal_lsn_diff": {GAUGE, "Lag in bytes between master and slave", nil, semver.MustParseRange(">=10.0.0")},
240-
"confirmed_flush_lsn": {DISCARD, "LSN position a consumer of a slot has confirmed flushing the data received", nil, nil},
241-
"write_lag": {DISCARD, "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it (but not yet flushed it or applied it). This can be used to gauge the delay that synchronous_commit level remote_write incurred while committing if this server was configured as a synchronous standby.", nil, semver.MustParseRange(">=10.0.0")},
242-
"flush_lag": {DISCARD, "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it (but not yet applied it). This can be used to gauge the delay that synchronous_commit level remote_flush incurred while committing if this server was configured as a synchronous standby.", nil, semver.MustParseRange(">=10.0.0")},
243-
"replay_lag": {DISCARD, "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it. This can be used to gauge the delay that synchronous_commit level remote_apply incurred while committing if this server was configured as a synchronous standby.", nil, semver.MustParseRange(">=10.0.0")},
244-
},
245204
"pg_stat_activity": {
246205
"datname": {LABEL, "Name of cu database", nil, nil},
247206
"state": {LABEL, "connection state", nil, semver.MustParseRange(">=9.2.0")},
@@ -286,35 +245,6 @@ var queryOverrides = map[string][]OverrideQuery{
286245
},
287246
},
288247

289-
"pg_stat_replication": {
290-
{
291-
semver.MustParseRange(">=10.0.0"),
292-
`
293-
SELECT *,
294-
(case pg_is_in_recovery() when 't' then null else pg_current_wal_lsn() end) AS pg_current_wal_lsn,
295-
(case pg_is_in_recovery() when 't' then null else pg_wal_lsn_diff(pg_current_wal_lsn(), replay_lsn)::float end) AS pg_wal_lsn_diff
296-
FROM pg_stat_replication
297-
`,
298-
},
299-
{
300-
semver.MustParseRange(">=9.2.0 <10.0.0"),
301-
`
302-
SELECT *,
303-
(case pg_is_in_recovery() when 't' then null else pg_current_xlog_location() end) AS pg_current_xlog_location,
304-
(case pg_is_in_recovery() when 't' then null else pg_xlog_location_diff(pg_current_xlog_location(), replay_location)::float end) AS pg_xlog_location_diff
305-
FROM pg_stat_replication
306-
`,
307-
},
308-
{
309-
semver.MustParseRange("<9.2.0"),
310-
`
311-
SELECT *,
312-
(case pg_is_in_recovery() when 't' then null else pg_current_xlog_location() end) AS pg_current_xlog_location
313-
FROM pg_stat_replication
314-
`,
315-
},
316-
},
317-
318248
"pg_stat_activity": {
319249
// This query only works
320250
{

queries.yaml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
pg_replication:
2-
query: "SELECT EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp()))::INT as lag"
3-
metrics:
4-
- lag:
5-
usage: "GAUGE"
6-
description: "Replication lag behind master in seconds"
7-
81
pg_postmaster:
92
query: "SELECT pg_postmaster_start_time as start_time_seconds from pg_postmaster_start_time()"
103
metrics:
@@ -78,9 +71,9 @@ pg_stat_user_tables:
7871
- autoanalyze_count:
7972
usage: "COUNTER"
8073
description: "Number of times this table has been analyzed by the autovacuum daemon"
81-
74+
8275
pg_database:
83-
query: " SELECT pg_database.datname, pg_database_size(pg_database.datname) as size FROM pg_database"
76+
query: " SELECT pg_database.datname, pg_database_size(pg_database.datname) as size FROM pg_database"
8477
metrics:
8578
- datname:
8679
usage: "LABEL"

0 commit comments

Comments
 (0)