Monitoring metrics reference v6.5.0

PGD Monitor collects these metrics and exposes them consistently across SQL, using bdr.ts_metrics() and related functions, as well as its REST API, its web UI, and its Prometheus /metrics endpoint. See PGD Monitor for how to enable and access each of those interfaces.

PGD timeseries metrics

These metrics come from the registry that bdr.ts_metrics() returns. The monitor worker samples them roughly every 10 seconds, except where noted.

MetricUnitSample intervalDescription
pgd_sys_cpu_pctPercent10sCPU utilization as a percentage of total capacity.
pgd_sys_mem_pctPercent10sMemory utilization as a percentage of total available.
pgd_sys_disk_pgdata_free_bytesBytes60sFree disk space on the PGDATA volume.
pgd_sys_disk_pgdata_total_bytesBytes60sTotal disk space on the PGDATA volume.
pgd_sys_disk_pgwal_free_bytesBytes60sFree disk space on the write-ahead log (WAL) volume.
pgd_sys_disk_pgwal_total_bytesBytes60sTotal disk space on the WAL volume.
pgd_pg_connectionsCount10sTotal number of active Postgres backend connections.
pgd_pg_active_queriesCount10sNumber of currently active (non-idle) queries.
pgd_connmgr_conns_rwCount10sClient connections through the Connection Manager's read-write proxy port.
pgd_connmgr_conns_roCount10sClient connections through the Connection Manager's read-only proxy port.
pgd_pg_tpsPer second10sCommitted and aborted transactions per second.
pgd_pg_cache_hit_pctPercent10sBuffer cache hit ratio of the PGD database.
pgd_pg_deadlocks_ratePer second10sDeadlocks per second in the PGD database.
pgd_pg_wraparound_age_maxCount60sAge in transactions of the oldest frozen-xid horizon across all databases.
pgd_pg_longest_tx_secondsSeconds10sAge in seconds of the longest open transaction.
pgd_max_replay_lag_bytesBytes10sMaximum replication replay lag in bytes across all peers.
pgd_oldest_kept_lag_bytesBytes10sSize of retained WAL needed by the cluster, kept using the group slot.
pgd_analytics_lag_bytesBytes10sReplication lag in bytes for analytics nodes.
pgd_clock_drift_max_millisecondsMilliseconds10sApproximate maximum clock drift across nodes.
pgd_conflicts_ratePer second10sReplication conflicts per second across all apply workers.
pgd_apply_errors_ratePer second10sApply errors per second across all apply workers.

Commit latency histogram

pgd_commit_latency_milliseconds is a histogram-kind metric giving the mean commit latency, in milliseconds, across all active commit scopes. The monitor worker samples it every 60 seconds. Read it with bdr.ts_histogram(), bdr.ts_histogram_distribution(), or bdr.ts_histogram_cumulative(), or as the _bucket, _sum, and _count series on the Prometheus endpoint.

Cluster state metrics

These identity and Raft metrics come from cached cluster catalog data rather than the timeseries registry, so they're available on the Prometheus endpoint and the REST API, but not through bdr.ts_metrics(). Unless noted, each is an identity metric with the constant value 1, carrying its payload in labels.

MetricLabelsDescription
pgd_node_infonode_nameIdentity of the node serving the request.
pgd_raft_statenode_group, stateRaft state of this node in the group.
pgd_raft_leadernode_group, node_nameCurrent Raft leader of the group.
pgd_raft_termnode_groupCurrent Raft term (gauge).
pgd_raft_commit_indexnode_groupRaft commit index (gauge).
pgd_write_leadernode_group, node_nameCurrent write leader of the group.
pgd_read_nodenode_group, node_nameA current read node of the group. Repeats once per read node.
pgd_replication_sent_lsn_bytestarget_nameWAL position sent to the target node, as bytes since 0/0.
pgd_replication_replay_lsn_bytestarget_nameWAL position applied by the target node, as bytes since 0/0.
pgd_replication_received_lsn_bytesorigin_nameWAL position received from the origin node, as bytes since 0/0.

Log sequence number (LSN) positions are exported as bytes since 0/0, so you can subtract them directly in PromQL. For example, sent minus replay equals apply lag in bytes.

Commit scope counters

Per-commit-scope transaction counters, labeled by commit_scope. Only scopes that have been used are reported.

MetricDescription
pgd_commit_scope_calls_totalTransactions that used the commit scope.
pgd_commit_scope_commits_totalCommits under the commit scope.
pgd_commit_scope_aborts_totalAborts under the commit scope.
pgd_commit_scope_degrades_totalTransactions that hit degraded mode under the commit scope.
pgd_commit_scope_config_degrades_totalTransactions started while the commit scope was already in degraded mode.

Postgres statistics metrics

These metrics mirror Prometheus postgres_exporter collectors, read from the local node's statistics views. They're available only on the Prometheus endpoint, and only when bdr.monitor_prometheus_pg_metrics is on (the default). Set it to off on a node if postgres_exporter already runs there and you don't want duplicate series, then reload the configuration. PGD-native metrics keep exporting either way.

Per database

Labeled by datname. Includes template databases, since their frozen-xid horizon matters for wraparound.

MetricTypeDescription
pgd_pg_stat_database_numbackendsGaugeBackends currently connected to the database.
pgd_pg_stat_database_xact_commit_totalCounterCommitted transactions.
pgd_pg_stat_database_xact_rollback_totalCounterRolled-back transactions.
pgd_pg_stat_database_blks_read_totalCounterDisk blocks read.
pgd_pg_stat_database_blks_hit_totalCounterDisk blocks found in shared buffers.
pgd_pg_stat_database_deadlocks_totalCounterDeadlocks detected.
pgd_pg_stat_database_temp_files_totalCounterTemporary files written by queries.
pgd_pg_stat_database_temp_bytes_totalCounterBytes written to temporary files by queries.
pgd_pg_database_wraparound_age_datfrozenxidGaugeAge in transactions of the database's frozen-xid horizon.
pgd_pg_database_wraparound_age_datminmxidGaugeAge in multixacts of the database's minimum-multixact horizon.
pgd_pg_database_size_bytesGaugeDatabase size in bytes.

Non-PGD replication slots

Labeled by slot_name, slot_type, and database. PGD's own slots already have dedicated pgd_replication_* families above, so this group catches external or orphaned slots instead, such as change data capture (CDC) consumers, removed subscribers, or physical standbys that silently retain WAL.

MetricDescription
pgd_pg_replication_slot_activeWhether the slot has an active connection.
pgd_pg_replication_slot_retained_wal_bytesWAL retained by the slot.
pgd_pg_replication_slot_safe_wal_size_bytesWAL the slot can still write before reaching max_slot_wal_keep_size.
pgd_pg_replication_slot_wal_statusWAL availability of the slot (identity metric, labeled wal_status with values reserved, extended, unreserved, or lost).

Instance-wide metrics

MetricTypeDescription
pgd_pg_wal_segmentsGaugeWAL segment files in pg_wal.
pgd_pg_wal_size_bytesGaugeTotal size of WAL segment files in pg_wal.
pgd_pg_stat_archiver_archived_totalCounterWAL files archived successfully.
pgd_pg_stat_archiver_failed_totalCounterFailed WAL archiving attempts.
pgd_pg_stat_archiver_last_archive_age_secondsGaugeSeconds since the last successful WAL archive. Absent until one succeeds.
pgd_pg_stat_checkpointer_timed_totalCounterScheduled checkpoints performed.
pgd_pg_stat_checkpointer_requested_totalCounterRequested checkpoints performed, driven by WAL volume rather than the schedule.
pgd_pg_stat_checkpointer_write_time_seconds_totalCounterSeconds spent writing checkpoint files to disk.
pgd_pg_stat_checkpointer_sync_time_seconds_totalCounterSeconds spent syncing checkpoint files to disk.
pgd_pg_stat_checkpointer_buffers_written_totalCounterBuffers written during checkpoints and restartpoints.
pgd_pg_stat_bgwriter_buffers_clean_totalCounterBuffers written by the background writer.
pgd_pg_stat_bgwriter_maxwritten_clean_totalCounterBackground writer cleaning scans stopped at the write limit.
pgd_pg_stat_bgwriter_buffers_alloc_totalCounterBuffers allocated.
pgd_pg_postmaster_start_time_secondsGaugeUnix timestamp of postmaster start, giving instance uptime.

On Postgres versions before 17, the checkpointer counters come from pg_stat_bgwriter instead. Metric names stay identical across versions.

Activity and locks

MetricLabelsDescription
pgd_pg_stat_activity_backendsstateClient backends by state.
pgd_pg_stat_activity_max_tx_duration_secondsstateAge of the oldest open transaction among client backends, by state.
pgd_pg_stat_activity_waiting_backendswait_event_typeBackends currently waiting, by wait event type. Idle background workers always report Activity waits. Contention shows up as Lock, LWLock, and BufferPin.
pgd_pg_locksmode, grantedLocks held or awaited, by lock mode. Rows with granted="false" are backends waiting on a lock.