@@ -315,6 +315,16 @@ var builtinMetricMaps = map[string]intermediateMetricMap{
315
315
true ,
316
316
0 ,
317
317
},
318
+ "pg_replication_slots" : {
319
+ map [string ]ColumnMapping {
320
+ "slot_name" : {LABEL , "Name of the replication slot" , nil , nil },
321
+ "database" : {LABEL , "Name of the database" , nil , nil },
322
+ "active" : {GAUGE , "Flag indicating if the slot is active" , nil , nil },
323
+ "pg_wal_lsn_diff" : {GAUGE , "Replication lag in bytes" , nil , nil },
324
+ },
325
+ true ,
326
+ 0 ,
327
+ },
318
328
"pg_stat_archiver" : {
319
329
map [string ]ColumnMapping {
320
330
"archived_count" : {COUNTER , "Number of WAL files that have been successfully archived" , nil , nil },
@@ -407,6 +417,16 @@ var queryOverrides = map[string][]OverrideQuery{
407
417
},
408
418
},
409
419
420
+ "pg_replication_slots" : {
421
+ {
422
+ semver .MustParseRange (">=9.4.0" ),
423
+ `
424
+ SELECT slot_name, database, active, pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)
425
+ FROM pg_replication_slots
426
+ ` ,
427
+ },
428
+ },
429
+
410
430
"pg_stat_archiver" : {
411
431
{
412
432
semver .MustParseRange (">=0.0.0" ),
0 commit comments