Skip to content

Commit 1e3b177

Browse files
committed
Fix column type for pg_replication_slots
Change the data type of `active` from int64 to bool. The documentation confirms that this is a boolean field. https://www.postgresql.org/docs/current/view-pg-replication-slots.html fixes prometheus-community#769 Signed-off-by: Joe Adams <github@joeadams.io>
1 parent 3fe5d25 commit 1e3b177

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

collector/replication_slots.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (PGReplicationSlotCollector) Update(ctx context.Context, db *sql.DB, ch cha
6969
var slot_name string
7070
var wal_lsn int64
7171
var flush_lsn int64
72-
var is_active int64
72+
var is_active bool
7373
if err := rows.Scan(&slot_name, &wal_lsn, &flush_lsn, &is_active); err != nil {
7474
return err
7575
}
@@ -78,7 +78,7 @@ func (PGReplicationSlotCollector) Update(ctx context.Context, db *sql.DB, ch cha
7878
pgReplicationSlot["current_wal_lsn"],
7979
prometheus.GaugeValue, float64(wal_lsn), slot_name,
8080
)
81-
if is_active == 1 {
81+
if is_active {
8282
ch <- prometheus.MustNewConstMetric(
8383
pgReplicationSlot["confirmed_flush_lsn"],
8484
prometheus.GaugeValue, float64(flush_lsn), slot_name,

0 commit comments

Comments
 (0)