Skip to content

Builtin metrics

Mikhail Grigorev edited this page Feb 11, 2024 · 3 revisions

Builtin metrics

List of builtin metrics and its descriptions.

Basically, the same list could be requested from pgSCV /metrics endpoint.



PostgreSQL Activity

  • postgres_activity_connections_all_in_flight Number of all connections in-flight.
  • postgres_activity_connections_in_flight Number of connections in-flight in each state.
  • postgres_activity_max_seconds Longest activity for each user, database and activity type.
  • postgres_activity_prepared_transactions_in_flight Number of transactions that are currently prepared for two-phase commit.
  • postgres_activity_queries_in_flight Number of queries running in-flight of each type.
  • postgres_activity_vacuums_in_flight Number of vacuum operations running in-flight of each type.
  • postgres_activity_wait_events_in_flight Number of wait events in-flight in each state.

PostgreSQL WAL Archiver

  • postgres_archiver_archived_total Total number of WAL segments had been successfully archived.
  • postgres_archiver_failed_total Total number of attempts when WAL segments had been failed to archive.
  • postgres_archiver_lag_bytes Amount of WAL segments ready, but not archived, in bytes.
  • postgres_archiver_since_last_archive_seconds Number of seconds since last WAL segment had been successfully archived.

PostgreSQL Checkpointer and Background Writer

  • postgres_checkpoints_all_total Total number of checkpoints that have been performed.
  • postgres_checkpoints_seconds_all_total Total amount of time that has been spent processing data during checkpoint, in seconds.
  • postgres_checkpoints_seconds_total Total amount of time that has been spent processing data during checkpoint in each stage, in seconds.
  • postgres_checkpoints_total Total number of checkpoints that have been performed of each type.
  • postgres_written_bytes_total Total number of bytes written by each subsystem, in bytes.
  • postgres_bgwriter_maxwritten_clean_total Total number of times the background writer stopped a cleaning scan because it had written too many buffers.
  • postgres_bgwriter_stats_age_seconds The age of the background writer activity statistics, in seconds.
  • postgres_backends_allocated_bytes_total Total number of bytes allocated by backends.
  • postgres_backends_fsync_total Total number of times a backends had to execute its own fsync() call.

PostgreSQL Recovery

  • postgres_recovery_conflicts_total Total number of recovery conflicts occurred by each conflict type.
  • postgres_recovery_info Current recovery state, 0 - not in recovery; 1 - in recovery.

PostgreSQL Databases

  • postgres_database_blk_time_seconds Time spent accessing data file blocks by backends in this database in each access type, in seconds.
  • postgres_database_blocks_total Total number of disk blocks had been accessed by each type of access.
  • postgres_database_conflicts_total Total number of recovery conflicts occurred.
  • postgres_database_deadlocks_total Total number of deadlocks occurred.
  • postgres_database_size_bytes Total size of the database, in bytes.
  • postgres_database_stats_age_seconds The age of the activity statistics, in seconds.
  • postgres_database_temp_bytes_total Total amount of data written to temporary files by queries.
  • postgres_database_temp_files_total Total number of temporary files created by queries.
  • postgres_database_tuples_total Total number of rows processed by each type of operation.
  • postgres_database_xact_commits_total Total number of transactions had been committed.
  • postgres_database_xact_rollbacks_total Total number of transactions had been rolled back.
  • postgres_xacts_left_before_wraparound The number of transactions left before force shutdown due to XID wraparound.

PostgreSQL Functions

  • postgres_function_calls_total Total number of times functions had been called.
  • postgres_function_self_time_seconds Total time spent in function itself, not including other functions called by it, in seconds.
  • postgres_function_total_time_seconds Total time spent in function and all other functions called by it, in seconds.

PostgreSQL Indexes

  • postgres_index_io_blocks_total Total number of indexes' blocks processed.
  • postgres_index_scans_total Total number of index scans initiated.
  • postgres_index_size_bytes Total size of the index, in bytes.
  • postgres_index_tuples_total Total number of index entries processed by scans.

PostgreSQL Locks

  • postgres_locks_all_in_flight Total number of all in-flight locks held by active processes.
  • postgres_locks_in_flight Number of in-flight locks held by active processes in each mode.
  • postgres_locks_not_granted_in_flight Number of in-flight not granted locks held by active processes.

PostgreSQL Logs

  • postgres_log_messages_total Total number of log messages written by each level.
  • postgres_log_panic_messages_total Total number of PANIC log messages written.
  • postgres_log_fatal_messages_total Total number of FATAL log messages written.
  • postgres_log_error_messages_total Total number of ERROR log messages written.
  • postgres_log_warning_messages_total Total number of WARNING log messages written.

PostgreSQL Replication

  • postgres_wal_written_bytes_total Total amount of WAL written (or received in case of standby), in bytes.
  • postgres_replication_lag_bytes Number of bytes standby is behind than primary in each WAL processing phase.
  • postgres_replication_lag_seconds Number of seconds standby is behind than primary in each WAL processing phase.
  • postgres_replication_lag_total_bytes Number of bytes standby is behind than primary including all phases.
  • postgres_replication_lag_total_seconds Number of seconds standby is behind than primary including all phases.

PostgreSQL Settings

  • postgres_service_files_info Labeled information about Postgres system files.
  • postgres_service_settings_info Labeled information about Postgres configuration settings.

PostgreSQL Statements

  • postgres_statements_query_info Labeled info about statements has been executed.
  • postgres_statements_calls_total Total number of times statement has been executed.
  • postgres_statements_rows_total Total number of rows retrieved or affected by the statement.
  • postgres_statements_shared_dirtied_bytes_total Total number of bytes dirtied in shared buffers by the statement.
  • postgres_statements_shared_hit_bytes_total Total number of bytes found in shared buffers by the statement.
  • postgres_statements_shared_read_bytes_total Total number of bytes read from disk or OS page cache when reading from shared buffers by the statement.
  • postgres_statements_shared_written_bytes_total Total number of bytes written to shared buffers by the statement.
  • postgres_statements_time_seconds_all_total Total time spent by the statement, in seconds.
  • postgres_statements_time_seconds_total Time spent by the statement in each mode, in seconds.
  • postgres_statements_wal_bytes_total Total number of WAL bytes (not including FPI) generated by the statement.
  • postgres_statements_wal_fpi_bytes_total Total number of WAL full-page images generated by the statement.
  • postgres_statements_wal_records_total Total number of WAL records generated by the statement.

PostgreSQL Storage

  • postgres_temp_bytes_in_flight Number of bytes occupied by temporary files processed in flight.
  • postgres_temp_files_all_bytes The size of all Postgres temp directories, in bytes.
  • postgres_temp_files_in_flight Number of temporary files processed in flight.
  • postgres_temp_files_max_age_seconds The age of the oldest temporary file, in seconds.
  • postgres_data_directory_bytes The size of Postgres server data directory, in bytes.
  • postgres_tablespace_directory_bytes The size of Postgres tablespace directory, in bytes.
  • postgres_wal_directory_bytes The size of Postgres server WAL directory, in bytes.
  • postgres_wal_directory_files The number of files in Postgres server WAL directory.
  • postgres_log_directory_bytes The size of Postgres server LOG directory, in bytes.
  • postgres_log_directory_files The number of files in Postgres server LOG directory.

PostrgeSQL Tables

  • postgres_table_idx_scan_total Total number of index scans initiated on this table.
  • postgres_table_idx_tup_fetch_total Total number of live rows fetched by index scans.
  • postgres_table_io_blocks_total Total number of table's blocks processed.
  • postgres_table_since_last_analyze_seconds_total Total time since table was analyzed manually or automatically, in seconds. DEPRECATED in favor postgres_table_last_analyze_time.
  • postgres_table_since_last_vacuum_seconds_total Total time since table was vacuumed manually or automatically (not counting VACUUM FULL), in seconds. DEPRECATED in favor postgres_table_last_vacuum_time.
  • postgres_table_last_vacuum_time Time of last vacuum or autovacuum has been done (not counting VACUUM FULL), in unixtime.
  • postgres_table_last_analyze_time Time of last analyze or autoanalyze has been done, in unixtime.
  • postgres_table_maintenance_total Total number of times this table has been maintained by each type of maintenance operation.
  • postgres_table_seq_scan_total The total number of sequential scans have been done.
  • postgres_table_seq_tup_read_total The total number of tuples have been read by sequential scans.
  • postgres_table_size_bytes Total size of the table, in bytes.
  • postgres_table_tuples_dead_total Estimated total number of dead tuples in the table.
  • postgres_table_tuples_deleted_total Total number of tuples (rows) have been deleted in the table.
  • postgres_table_tuples_hot_updated_total Total number of tuples (rows) have been updated in the table.
  • postgres_table_tuples_inserted_total Total number of tuples (rows) have been inserted in the table.
  • postgres_table_tuples_live_total Estimated total number of live tuples in the table.
  • postgres_table_tuples_modified_total Estimated total number of modified tuples in the table since last vacuum.
  • postgres_table_tuples_updated_total Total number of tuples (rows) have been updated in the table (including HOT).

Pgbouncer

  • pgbouncer_pool_connections_in_flight The total number of connections established by each state.
  • pgbouncer_pool_max_wait_seconds Total time the first (oldest) client in the queue has waited, in seconds.
  • pgbouncer_client_connections_in_flight The total number of client connections established by source address.
  • pgbouncer_service_database_pool_size Maximum size of pools for the database.
  • pgbouncer_service_database_settings_info Labeled information about Pgbouncer's per-database configuration settings.
  • pgbouncer_service_settings_info Labeled information about Pgbouncer configuration settings.
  • pgbouncer_transactions_total Total number of SQL transactions processed, for each database.
  • pgbouncer_queries_total Total number of SQL queries processed, for each database.
  • pgbouncer_bytes_total Total volume of network traffic processed by pgbouncer in each direction, in bytes.
  • pgbouncer_spent_seconds_total Total number of time spent by pgbouncer when connected to PostgreSQL executing queries or processing transactions, in seconds.

CPU

  • node_cpu_guest_seconds_total Seconds the CPUs spent in guests (VMs) for each mode.
  • node_cpu_seconds_all_total Seconds the CPUs spent in all modes.
  • node_cpu_seconds_total Seconds the CPUs spent in each mode.
  • node_uptime_idle_seconds_total Total number of seconds all cores have spent idle, accordingly to /proc/uptime.
  • node_uptime_up_seconds_total Total number of seconds the system has been up, accordingly to /proc/uptime.

Disk

  • node_disk_bytes_all_total The total number of bytes processed by IO requests.
  • node_disk_bytes_total The total number of bytes processed by IO requests of each type.
  • node_disk_completed_all_total The total number of IO requests completed successfully.
  • node_disk_completed_total The total number of IO requests completed successfully of each type.
  • node_disk_io_now The number of I/Os currently in progress.
  • node_disk_io_time_seconds_total Total seconds spent doing I/Os.
  • node_disk_io_time_weighted_seconds_total The weighted number of seconds spent doing I/Os.
  • node_disk_merged_all_total The total number of merged IO requests.
  • node_disk_merged_total The total number of merged IO requests of each type.
  • node_disk_time_seconds_all_total The total number of seconds spent on all requests.
  • node_disk_time_seconds_total The total number of seconds spent on all requests of each type.
  • node_system_storage_info Labeled information about storage devices present in the system.

Filesystems

  • node_filesystem_bytes Number of bytes of filesystem by usage.
  • node_filesystem_bytes_total Total number of bytes of filesystem capacity.
  • node_filesystem_files Number of files (inodes) of filesystem by usage.
  • node_filesystem_files_total Total number of files (inodes) of filesystem capacity.

Load average

  • node_load1 1m load average.
  • node_load15 15m load average.
  • node_load5 5m load average.

Memory

  • node_memory_Active Memory information field Active.
  • node_memory_Active_anon Memory information field Active_anon.
  • node_memory_Active_file Memory information field Active_file.
  • node_memory_AnonHugePages Memory information field AnonHugePages.
  • node_memory_AnonPages Memory information field AnonPages.
  • node_memory_Bounce Memory information field Bounce.
  • node_memory_Buffers Memory information field Buffers.
  • node_memory_Cached Memory information field Cached.
  • node_memory_CmaFree Memory information field CmaFree.
  • node_memory_CmaTotal Memory information field CmaTotal.
  • node_memory_CommitLimit Memory information field CommitLimit.
  • node_memory_Committed_AS Memory information field Committed_AS.
  • node_memory_DirectMap1G Memory information field DirectMap1G.
  • node_memory_DirectMap2M Memory information field DirectMap2M.
  • node_memory_DirectMap4k Memory information field DirectMap4k.
  • node_memory_Dirty Memory information field Dirty.
  • node_memory_FileHugePages Memory information field FileHugePages.
  • node_memory_FilePmdMapped Memory information field FilePmdMapped.
  • node_memory_HardwareCorrupted Memory information field HardwareCorrupted.
  • node_memory_HugePages_Free Memory information field HugePages_Free.
  • node_memory_HugePages_Rsvd Memory information field HugePages_Rsvd.
  • node_memory_HugePages_Surp Memory information field HugePages_Surp.
  • node_memory_HugePages_Total Memory information field HugePages_Total.
  • node_memory_Hugepagesize Memory information field Hugepagesize.
  • node_memory_Hugetlb Memory information field Hugetlb.
  • node_memory_Inactive Memory information field Inactive.
  • node_memory_Inactive_anon Memory information field Inactive_anon.
  • node_memory_Inactive_file Memory information field Inactive_file.
  • node_memory_KReclaimable Memory information field KReclaimable.
  • node_memory_KernelStack Memory information field KernelStack.
  • node_memory_Mapped Memory information field Mapped.
  • node_memory_MemAvailable Memory information field MemAvailable.
  • node_memory_MemFree Memory information field MemFree.
  • node_memory_MemTotal Memory information field MemTotal.
  • node_memory_MemUsed Memory information composite field MemUsed.
  • node_memory_Mlocked Memory information field Mlocked.
  • node_memory_NFS_Unstable Memory information field NFS_Unstable.
  • node_memory_PageTables Memory information field PageTables.
  • node_memory_Percpu Memory information field Percpu.
  • node_memory_SReclaimable Memory information field SReclaimable.
  • node_memory_SUnreclaim Memory information field SUnreclaim.
  • node_memory_Shmem Memory information field Shmem.
  • node_memory_ShmemHugePages Memory information field ShmemHugePages.
  • node_memory_ShmemPmdMapped Memory information field ShmemPmdMapped.
  • node_memory_Slab Memory information field Slab.
  • node_memory_SwapCached Memory information field SwapCached.
  • node_memory_SwapFree Memory information field SwapFree.
  • node_memory_SwapTotal Memory information field SwapTotal.
  • node_memory_SwapUsed Memory information composite field SwapUsed.
  • node_memory_Unevictable Memory information field Unevictable.
  • node_memory_VmallocChunk Memory information field VmallocChunk.
  • node_memory_VmallocTotal Memory information field VmallocTotal.
  • node_memory_VmallocUsed Memory information field VmallocUsed.
  • node_memory_Writeback Memory information field Writeback.
  • node_memory_WritebackTmp Memory information field WritebackTmp.

NOTE: real number of metrics depends on kernel version and content of /proc/meminfo.

Networking

  • node_network_bytes_total Total number of bytes processed by network device, by each direction.
  • node_network_events_total Total number of events occurred on network device, by each type and direction.
  • node_network_packets_total Total number of packets processed by network device, by each direction.
  • node_network_private_addresses Number of private network addresses present on the system, by type.
  • node_network_public_addresses Number of public network addresses present on the system, by type.

System

  • node_system_cpu_cores_total Total number of CPU cores in each state.
  • node_system_numa_nodes_total Total number of NUMA nodes in the system.
  • node_system_scaling_governors_total Total number of CPU scaling governors used of each type.
  • node_system_sysctl Node sysctl system settings.
  • node_context_switches_total Total number of context switches.
  • node_forks_total Total number of forks.
  • node_boot_time_seconds Node boot time, in unixtime.