Builtin metrics - cherts/pgscv GitHub Wiki
Builtin metrics
List of builtin metrics and its descriptions.
Basically, the same list could be requested from pgSCV /metrics endpoint.
-
PostgreSQL:
-
System:
PostgreSQL General
postgres_upState of PostgreSQL service: 0 is down, 1 is up.postgres_start_time_secondsPostgres start time, in unixtime.
PostgreSQL Activity
postgres_activity_connections_all_in_flightNumber of all connections in-flight.postgres_activity_connections_in_flightNumber of connections in-flight in each state.postgres_activity_max_secondsLongest activity for each user, database and activity type.postgres_activity_prepared_transactions_in_flightNumber of transactions that are currently prepared for two-phase commit.postgres_activity_queries_in_flightNumber of queries running in-flight of each type.postgres_activity_vacuums_in_flightNumber of vacuum operations running in-flight of each type.postgres_activity_wait_events_in_flightNumber of wait events in-flight in each state.
PostgreSQL WAL Archiver
postgres_archiver_archived_totalTotal number of WAL segments had been successfully archived.postgres_archiver_failed_totalTotal number of attempts when WAL segments had been failed to archive.postgres_archiver_lag_bytesAmount of WAL segments ready, but not archived, in bytes.postgres_archiver_since_last_archive_secondsNumber of seconds since last WAL segment had been successfully archived.
PostgreSQL Checkpointer and Background Writer
postgres_checkpoints_all_totalTotal number of checkpoints that have been performed.postgres_checkpoints_seconds_all_totalTotal amount of time that has been spent processing data during checkpoint, in seconds.postgres_checkpoints_seconds_totalTotal amount of time that has been spent processing data during checkpoint in each stage, in seconds.postgres_checkpoints_totalTotal number of checkpoints that have been performed of each type.postgres_written_bytes_totalTotal number of bytes written by each subsystem, in bytes.postgres_bgwriter_maxwritten_clean_totalTotal number of times the background writer stopped a cleaning scan because it had written too many buffers.postgres_bgwriter_stats_age_secondsThe age of the background writer activity statistics, in seconds.postgres_backends_allocated_bytes_totalTotal number of bytes allocated by backends.postgres_backends_fsync_totalTotal number of times a backends had to execute its own fsync() call.
PostgreSQL Recovery
postgres_recovery_conflicts_totalTotal number of recovery conflicts occurred by each conflict type.postgres_recovery_infoCurrent recovery state, 0 - not in recovery; 1 - in recovery.postgres_recovery_pauseCurrent recovery pause state, 0 - recovery pause is not requested; 1 - recovery pause is requested.
PostgreSQL Databases
postgres_database_blk_time_secondsTime spent accessing data file blocks by backends in this database in each access type, in seconds.postgres_database_blocks_totalTotal number of disk blocks had been accessed by each type of access.postgres_database_conflicts_totalTotal number of recovery conflicts occurred.postgres_database_deadlocks_totalTotal number of deadlocks occurred.postgres_database_size_bytesTotal size of the database, in bytes.postgres_database_stats_age_secondsThe age of the activity statistics, in seconds.postgres_database_temp_bytes_totalTotal amount of data written to temporary files by queries.postgres_database_temp_files_totalTotal number of temporary files created by queries.postgres_database_tuples_totalTotal number of rows processed by each type of operation.postgres_database_xact_commits_totalTotal number of transactions had been committed.postgres_database_xact_rollbacks_totalTotal number of transactions had been rolled back.postgres_xacts_left_before_wraparoundThe number of transactions left before force shutdown due to XID wraparound.postgres_database_parallel_workersTotal number of parallel workers to launch and launched in this database (only PostgreSQL v18+).
PostgreSQL Functions
postgres_function_calls_totalTotal number of times functions had been called.postgres_function_self_time_secondsTotal time spent in function itself, not including other functions called by it, in seconds.postgres_function_total_time_secondsTotal time spent in function and all other functions called by it, in seconds.
PostgreSQL Indexes
postgres_index_io_blocks_totalTotal number of indexes' blocks processed.postgres_index_scans_totalTotal number of index scans initiated.postgres_index_size_bytesTotal size of the index, in bytes.postgres_index_tuples_totalTotal number of index entries processed by scans.
PostgreSQL Locks
postgres_locks_all_in_flightTotal number of all in-flight locks held by active processes.postgres_locks_in_flightNumber of in-flight locks held by active processes in each mode.postgres_locks_not_granted_in_flightNumber of in-flight not granted locks held by active processes.
PostgreSQL Logs
postgres_log_messages_totalTotal number of log messages written by each level.postgres_log_panic_messages_totalTotal number of PANIC log messages written.postgres_log_fatal_messages_totalTotal number of FATAL log messages written.postgres_log_error_messages_totalTotal number of ERROR log messages written.postgres_log_warning_messages_totalTotal number of WARNING log messages written.
PostgreSQL Replication
postgres_wal_written_bytes_totalTotal amount of WAL written (or received in case of standby) since cluster init, in bytes.postgres_replication_lag_bytesNumber of bytes standby is behind than primary in each WAL processing phase.postgres_replication_lag_secondsNumber of seconds standby is behind than primary in each WAL processing phase.postgres_replication_lag_total_bytesNumber of bytes standby is behind than primary including all phases.postgres_replication_lag_total_secondsNumber of seconds standby is behind than primary including all phases.
PostgreSQL WAL
postgres_wal_records_total- Total number of WAL records generated (zero in case of standby).postgres_wal_fpi_total- Total number of WAL full page images generated (zero in case of standby).postgres_wal_bytes_total- Total amount of WAL generated (zero in case of standby) since last stats reset, in bytes.postgres_wal_buffers_full_total- Total number of times WAL data was written to disk because WAL buffers became full (zero in case of standby).postgres_wal_write_total- Total number of times WAL buffers were written out to disk via XLogWrite request (zero in case of standby).postgres_wal_sync_total- Total number of times WAL files were synced to disk via issue_xlog_fsync request (zero in case of standby).postgres_wal_seconds_total- Total amount of time spent processing WAL buffers by each operation (zero in case of standby), in seconds.postgres_wal_seconds_all_total- Total amount of time spent processing WAL buffers (zero in case of standby), in seconds.postgres_wal_stats_reset_time- Time at which WAL statistics were last reset, in unixtime.
PostgreSQL Settings
postgres_service_files_infoLabeled information about Postgres system files.postgres_service_settings_infoLabeled information about Postgres configuration settings.
PostgreSQL Statements
postgres_statements_query_infoLabeled info about statements has been executed.postgres_statements_calls_totalTotal number of times statement has been executed.postgres_statements_rows_totalTotal number of rows retrieved or affected by the statement.postgres_statements_shared_dirtied_bytes_totalTotal number of bytes dirtied in shared buffers by the statement.postgres_statements_shared_hit_bytes_totalTotal number of bytes found in shared buffers by the statement.postgres_statements_shared_read_bytes_totalTotal number of bytes read from disk or OS page cache when reading from shared buffers by the statement.postgres_statements_shared_written_bytes_totalTotal number of bytes written to shared buffers by the statement.postgres_statements_time_seconds_all_totalTotal time spent by the statement, in seconds.postgres_statements_time_seconds_totalTime spent by the statement in each mode, in seconds.postgres_statements_wal_bytes_totalTotal number of WAL bytes (not including FPI) generated by the statement.postgres_statements_wal_fpi_bytes_totalTotal number of WAL full-page images generated by the statement.postgres_statements_wal_records_totalTotal number of WAL records generated by the statement.
PostgreSQL Storage
postgres_temp_bytes_in_flightNumber of bytes occupied by temporary files processed in flight.postgres_temp_files_all_bytesThe size of all Postgres temp directories, in bytes.postgres_temp_files_in_flightNumber of temporary files processed in flight.postgres_temp_files_max_age_secondsThe age of the oldest temporary file, in seconds.postgres_data_directory_bytesThe size of Postgres server data directory, in bytes.postgres_tablespace_directory_bytesThe size of Postgres tablespace directory, in bytes.postgres_wal_directory_bytesThe size of Postgres server WAL directory, in bytes.postgres_wal_directory_filesThe number of files in Postgres server WAL directory.postgres_log_directory_bytesThe size of Postgres server LOG directory, in bytes.postgres_log_directory_filesThe number of files in Postgres server LOG directory.
PostgreSQL Stat IO
postgres_stat_io_readsNumber of read operations, each of the size specified in op_bytes.postgres_stat_io_read_bytesNumber of read, in bytes.postgres_stat_io_read_timeTime spent in read operations in milliseconds (if track_io_timing is enabled, otherwise zero)postgres_stat_io_writesNumber of write operations, each of the size specified in op_bytes.postgres_stat_io_write_bytesNumber of write, in bytes.postgres_stat_io_write_timeTime spent in write operations in milliseconds (if track_io_timing is enabled, otherwise zero)postgres_stat_io_writebacksNumber of units of size op_bytes which the process requested the kernel write out to permanent storage.postgres_stat_io_writeback_timeTime spent in writeback operations in milliseconds (if track_io_timing is enabled, otherwise zero). This includes the time spent queueing write-out requests and, potentially, the time spent to write out the dirty data.postgres_stat_io_extendsNumber of relation extend operations, each of the size specified in op_bytes.postgres_stat_io_extend_bytesNumber of relation extend, in bytes.postgres_stat_io_extend_timeTime spent in extend operations in milliseconds (if track_io_timing is enabled, otherwise zero)postgres_stat_io_hitsThe number of times a desired block was found in a shared buffer.postgres_stat_io_evictionsNumber of times a block has been written out from a shared or local buffer in order to make it available for another use.postgres_stat_io_reusesThe number of times an existing buffer in a size-limited ring buffer outside of shared buffers was reused as part of an I/O operation in the bulkread, bulkwrite, or vacuum contexts.postgres_stat_io_fsyncsNumber of fsync calls. These are only tracked in context normal.postgres_stat_io_fsync_timeTime spent in fsync operations in milliseconds (if track_io_timing is enabled, otherwise zero)
PostgreSQL Stat SLRU
postgres_stat_slru_blks_existsNumber of blocks checked for existence for this SLRU.postgres_stat_slru_blks_hitNumber of times disk blocks were found already in the SLRU, so that a read was not necessary (this only includes hits in the SLRU, not the operating system's file system cache).postgres_stat_slru_blks_readNumber of disk blocks read for this SLRU.postgres_stat_slru_blks_writtenNumber of disk blocks written for this SLRU.postgres_stat_slru_blks_zeroedNumber of blocks zeroed during initializations.postgres_stat_slru_flushesNumber of flushes of dirty data for this SLRU.postgres_stat_slru_truncatesNumber of truncates for this SLRU.
PostgreSQL Stat SSL
postgres_stat_ssl_conn_numberNumber of SSL connections.
PostgreSQL Stat Subscription
postgres_stat_subscription_error_countNumber of times an error occurred (applying changes OR initial table synchronization).postgres_stat_subscription_msg_recv_timeReceipt time of last message received from origin WAL sender.postgres_stat_subscription_msg_send_timeSend time of last message received from origin WAL sender.postgres_stat_subscription_reported_timeTime of last write-ahead log location reported to origin WAL sender.postgres_stat_subscription_received_lsnLast write-ahead log location received.postgres_stat_subscription_reported_lsnLast write-ahead log location reported to origin WAL sender.postgres_stat_subscription_confl_countNumber of times an additional conflict error occurred (only PostgreSQL v18+).
PostrgeSQL Tables
postgres_table_idx_scan_totalTotal number of index scans initiated on this table.postgres_table_idx_tup_fetch_totalTotal number of live rows fetched by index scans.postgres_table_io_blocks_totalTotal number of table's blocks processed.postgres_table_since_last_analyze_seconds_totalTotal time since table was analyzed manually or automatically, in seconds. DEPRECATED in favorpostgres_table_last_analyze_time.postgres_table_since_last_vacuum_seconds_totalTotal time since table was vacuumed manually or automatically (not counting VACUUM FULL), in seconds. DEPRECATED in favorpostgres_table_last_vacuum_time.postgres_table_last_vacuum_timeTime of last vacuum or autovacuum has been done (not counting VACUUM FULL), in unixtime.postgres_table_last_analyze_timeTime of last analyze or autoanalyze has been done, in unixtime.postgres_table_maintenance_totalTotal number of times this table has been maintained by each type of maintenance operation.postgres_table_seq_scan_totalThe total number of sequential scans have been done.postgres_table_seq_tup_read_totalThe total number of tuples have been read by sequential scans.postgres_table_size_bytesTotal size of the table, in bytes.postgres_table_tuples_dead_totalEstimated total number of dead tuples in the table.postgres_table_tuples_deleted_totalTotal number of tuples (rows) have been deleted in the table.postgres_table_tuples_hot_updated_totalTotal number of tuples (rows) have been updated in the table.postgres_table_tuples_inserted_totalTotal number of tuples (rows) have been inserted in the table.postgres_table_tuples_live_totalEstimated total number of live tuples in the table.postgres_table_tuples_modified_totalEstimated total number of modified tuples in the table since last vacuum.postgres_table_tuples_updated_totalTotal number of tuples (rows) have been updated in the table (including HOT).
Pgbouncer
pgbouncer_pool_connections_in_flightThe total number of connections established by each state.pgbouncer_pool_max_wait_secondsTotal time the first (oldest) client in the queue has waited, in seconds.pgbouncer_client_connections_in_flightThe total number of client connections established by source address.pgbouncer_service_database_pool_sizeMaximum size of pools for the database.pgbouncer_service_database_settings_infoLabeled information about Pgbouncer's per-database configuration settings.pgbouncer_service_settings_infoLabeled information about Pgbouncer configuration settings.pgbouncer_transactions_totalTotal number of SQL transactions processed, for each database.pgbouncer_queries_totalTotal number of SQL queries processed, for each database.pgbouncer_bytes_totalTotal volume of network traffic processed by pgbouncer in each direction, in bytes.pgbouncer_spent_seconds_totalTotal number of time spent by pgbouncer when connected to PostgreSQL executing queries or processing transactions, in seconds.
Patroni
patroni_cluster_unlockedValue is 1 if the cluster is unlocked, 0 if locked.patroni_dcs_last_seenEpoch timestamp when DCS was last contacted successfully by Patroni.patroni_failsafe_mode_is_activeValue is 1 if failsafe mode is active, 0 if inactive.patroni_is_pausedValue is 1 if auto failover is disabled, 0 otherwise.patroni_last_timeline_change_secondsEpoch seconds since latest timeline switched.patroni_loop_waitCurrent loop_wait setting of the Patroni configuration.patroni_masterValue is 1 if this node is the leader, 0 otherwise.patroni_maximum_lag_on_failoverCurrent maximum_lag_on_failover setting of the Patroni configuration.patroni_node_nameNode name.patroni_pending_restartValue is 1 if the node needs a restart, 0 otherwise.patroni_postgres_in_archive_recoveryValue is 1 if Postgres is replicating from archive, 0 otherwise.patroni_postgres_runningValue is 1 if Postgres is running, 0 otherwise.patroni_postgres_server_versionVersion of Postgres (if running), 0 otherwise.patroni_postgres_streamingValue is 1 if Postgres is streaming, 0 otherwise.patroni_postgres_timelinePostgres timeline of this node (if running), 0 otherwise.patroni_postmaster_start_timeEpoch seconds since Postgres started.patroni_replicaValue is 1 if this node is a replica, 0 otherwise.patroni_retry_timeoutCurrent retry_timeout setting of the Patroni configuration.patroni_standby_leaderValue is 1 if this node is the standby_leader, 0 otherwise.patroni_sync_standbyValue is 1 if synchronous mode is active, 0 if inactive.patroni_ttlCurrent ttl setting of the Patroni configuration.patroni_upState of Patroni service: 1 is up, 0 otherwise.patroni_versionNumeric representation of Patroni version.patroni_xlog_locationCurrent location of the Postgres transaction log, 0 if this node is a replica.patroni_xlog_pausedValue is 1 if the replaying of Postgres transaction log is paused, 0 otherwise.patroni_xlog_received_locationCurrent location of the received Postgres transaction log, 0 if this node is the leader.patroni_xlog_replayed_locationCurrent location of the replayed Postgres transaction log, 0 if this node is the leader.patroni_xlog_replayed_timestampCurrent timestamp of the replayed Postgres transaction log, 0 if null.
CPU
node_cpu_guest_seconds_totalSeconds the CPUs spent in guests (VMs) for each mode.node_cpu_seconds_all_totalSeconds the CPUs spent in all modes.node_cpu_seconds_totalSeconds the CPUs spent in each mode.node_uptime_idle_seconds_totalTotal number of seconds all cores have spent idle, accordingly to /proc/uptime.node_uptime_up_seconds_totalTotal number of seconds the system has been up, accordingly to /proc/uptime.
Disk
node_disk_bytes_all_totalThe total number of bytes processed by IO requests.node_disk_bytes_totalThe total number of bytes processed by IO requests of each type.node_disk_completed_all_totalThe total number of IO requests completed successfully.node_disk_completed_totalThe total number of IO requests completed successfully of each type.node_disk_io_nowThe number of I/Os currently in progress.node_disk_io_time_seconds_totalTotal seconds spent doing I/Os.node_disk_io_time_weighted_seconds_totalThe weighted number of seconds spent doing I/Os.node_disk_merged_all_totalThe total number of merged IO requests.node_disk_merged_totalThe total number of merged IO requests of each type.node_disk_time_seconds_all_totalThe total number of seconds spent on all requests.node_disk_time_seconds_totalThe total number of seconds spent on all requests of each type.node_system_storage_infoLabeled information about storage devices present in the system.
Filesystems
node_filesystem_bytesNumber of bytes of filesystem by usage.node_filesystem_bytes_totalTotal number of bytes of filesystem capacity.node_filesystem_filesNumber of files (inodes) of filesystem by usage.node_filesystem_files_totalTotal number of files (inodes) of filesystem capacity.
Load average
node_load11m load average.node_load1515m load average.node_load55m load average.
Memory
node_memory_ActiveMemory information field Active.node_memory_Active_anonMemory information field Active_anon.node_memory_Active_fileMemory information field Active_file.node_memory_AnonHugePagesMemory information field AnonHugePages.node_memory_AnonPagesMemory information field AnonPages.node_memory_BounceMemory information field Bounce.node_memory_BuffersMemory information field Buffers.node_memory_CachedMemory information field Cached.node_memory_CmaFreeMemory information field CmaFree.node_memory_CmaTotalMemory information field CmaTotal.node_memory_CommitLimitMemory information field CommitLimit.node_memory_Committed_ASMemory information field Committed_AS.node_memory_DirectMap1GMemory information field DirectMap1G.node_memory_DirectMap2MMemory information field DirectMap2M.node_memory_DirectMap4kMemory information field DirectMap4k.node_memory_DirtyMemory information field Dirty.node_memory_FileHugePagesMemory information field FileHugePages.node_memory_FilePmdMappedMemory information field FilePmdMapped.node_memory_HardwareCorruptedMemory information field HardwareCorrupted.node_memory_HugePages_FreeMemory information field HugePages_Free.node_memory_HugePages_RsvdMemory information field HugePages_Rsvd.node_memory_HugePages_SurpMemory information field HugePages_Surp.node_memory_HugePages_TotalMemory information field HugePages_Total.node_memory_HugepagesizeMemory information field Hugepagesize.node_memory_HugetlbMemory information field Hugetlb.node_memory_InactiveMemory information field Inactive.node_memory_Inactive_anonMemory information field Inactive_anon.node_memory_Inactive_fileMemory information field Inactive_file.node_memory_KReclaimableMemory information field KReclaimable.node_memory_KernelStackMemory information field KernelStack.node_memory_MappedMemory information field Mapped.node_memory_MemAvailableMemory information field MemAvailable.node_memory_MemFreeMemory information field MemFree.node_memory_MemTotalMemory information field MemTotal.node_memory_MemUsedMemory information composite field MemUsed.node_memory_MlockedMemory information field Mlocked.node_memory_NFS_UnstableMemory information field NFS_Unstable.node_memory_PageTablesMemory information field PageTables.node_memory_PercpuMemory information field Percpu.node_memory_SReclaimableMemory information field SReclaimable.node_memory_SUnreclaimMemory information field SUnreclaim.node_memory_ShmemMemory information field Shmem.node_memory_ShmemHugePagesMemory information field ShmemHugePages.node_memory_ShmemPmdMappedMemory information field ShmemPmdMapped.node_memory_SlabMemory information field Slab.node_memory_SwapCachedMemory information field SwapCached.node_memory_SwapFreeMemory information field SwapFree.node_memory_SwapTotalMemory information field SwapTotal.node_memory_SwapUsedMemory information composite field SwapUsed.node_memory_UnevictableMemory information field Unevictable.node_memory_VmallocChunkMemory information field VmallocChunk.node_memory_VmallocTotalMemory information field VmallocTotal.node_memory_VmallocUsedMemory information field VmallocUsed.node_memory_WritebackMemory information field Writeback.node_memory_WritebackTmpMemory information field WritebackTmp.
NOTE: real number of metrics depends on kernel version and content of /proc/meminfo.
Networking
node_network_bytes_totalTotal number of bytes processed by network device, by each direction.node_network_events_totalTotal number of events occurred on network device, by each type and direction.node_network_packets_totalTotal number of packets processed by network device, by each direction.node_network_private_addressesNumber of private network addresses present on the system, by type.node_network_public_addressesNumber of public network addresses present on the system, by type.
System
node_system_cpu_cores_totalTotal number of CPU cores in each state.node_system_numa_nodes_totalTotal number of NUMA nodes in the system.node_system_scaling_governors_totalTotal number of CPU scaling governors used of each type.node_system_sysctlNode sysctl system settings.node_context_switches_totalTotal number of context switches.node_forks_totalTotal number of forks.node_boot_time_secondsNode boot time, in unixtime.