Skip to main content
Version: Develop

Service Instance Metrics

This page describes the metrics used to monitor state of an a9s PostgreSQL. Service Instance. For further information on how to monitor an a9s Service Instance, see the Set up Monitoring section of the Application Developer's documentation.

Metric groups

Custom parameter nameSuggested (interval in seconds)Default value (interval in seconds)Description
metric_pg_database_size300300This group lets you see how quickly your database is growing.
metric_pg_stat_all_indexes300This group provides status information on all indexes.
metric_pg_statio_all_indexes600This group provides information on index usage for all indexes.
metric_pg_statio_all_tables300This group provides information on table usage for all tables.
metric_pg_stat_all_tables1200This group provides the status of all tables.
metric_pg_stat_archiver_table3000This group provides the archival status. Useful with continuous archiving enabled.
metric_pg_stat_database1200This group provides the general status of each database.
metric_pg_stat_database_conflicts3000This group provides insights on database conflicts.
metric_pg_replication1010This group provides the status of replication. Useful when the Service Instance is a replica set.
metric_pg_node_status1010This group provides metrics based on node state

Metric group patterns

Each metric group has a set of patterns that describe the metrics contained in each group.

note

These metrics are dynamic between the PostgreSQL versions, therefore some of them might differ based on the PostgreSQL version that is currently running on the Service Instance. In order to be sure, search into the documentation link provided in the metric item and confirm the information based on PostgreSQL metric and PostgreSQL version.

metric_pg_database_size

Metric IdTypeDescription
pg_database_sizeBigint (Bytes)Database size.
*.*.postgres.*.*.*.*.database.*.pg_database_size

metric_pg_stat_all_indexes

The pg_stat_all_indexes view will contain one row for each index in the current database, showing statistics about accesses to that specific index. The pg_stat_user_indexes and pg_stat_sys_indexes views contain the same information, but filtered to only show user and system indexes respectively.

Metric IdTypeDescription
idx_scanBigintNumber of index scans initiated on this index. documentation
idx_tup_readBigintNumber of index entries returned by scans on this index. documentation
idx_tup_fetchBigintNumber of live table rows fetched by simple index scans using this index. documentation
Metrics
*.*.postgres.*.*.*.*.database.*.table.*.*.index.*.*.*.idx_scan
*.*.postgres.*.*.*.*.database.*.table.*.*.index.*.*.*.idx_tup_read
*.*.postgres.*.*.*.*.database.*.table.*.*.index.*.*.*.idx_tup_fetch

metric_pg_statio_all_indexes

The pg_statio_all_indexes view will contain one row for each index in the current database, showing statistics about I/O on that specific index. The pg_statio_user_indexes and pg_statio_sys_indexes views contain the same information, but filtered to only show user and system indexes respectively.

Metric IdtypeDescription
idx_blks_readBigintNumber of disk blocks read from all indexes on this table. documentation
idx_blks_hitBigintNumber of buffer hits in all indexes on this table. documentation
Metrics
*.*.postgres.*.*.*.*.database.*.table.*.*.index.*.*.*.idx_blks_read
*.*.postgres.*.*.*.*.database.*.table.*.*.index.*.*.*.idx_blks_hit

metric_pg_statio_all_tables

The pg_statio_all_tables view will contain one row for each table in the current database (including TOAST tables), showing statistics about I/O on that specific table. The pg_statio_user_tables and pg_statio_sys_tables views contain the same information, but filtered to only show user and system tables respectively.

Metric IdtypeDescription
heap_blks_readBigintNumber of disk blocks read from this table.documentation
heap_blks_hitBigintNumber of buffer hits in this table. documentation
idx_blks_readBigintNumber of disk blocks read from all indexes on this table. documentation
idx_blks_hitBigintNumber of buffer hits in all indexes on this table. documentation
toast_blks_readBigintNumber of disk blocks read from this table's TOAST table (if any). documentation
toast_blks_hitBigintNumber of buffer hits in this table's TOAST table (if any). documentation
tidx_blks_readBigintNumber of disk blocks read from this table's TOAST table indexes (if any). documentation
tidx_blks_hitBigintNumber of buffer hits in this table's TOAST table indexes (if any). documentation
Metrics
*.*.postgres.*.*.*.*.database.*.io_table.*.*.*.heap_blks_read
*.*.postgres.*.*.*.*.database.*.io_table.*.*.*.heap_blks_hit
*.*.postgres.*.*.*.*.database.*.io_table.*.*.*.idx_blks_read
*.*.postgres.*.*.*.*.database.*.io_table.*.*.*.idx_blks_hit
*.*.postgres.*.*.*.*.database.*.io_table.*.*.*.toast_blks_read
*.*.postgres.*.*.*.*.database.*.io_table.*.*.*.toast_blks_hit
*.*.postgres.*.*.*.*.database.*.io_table.*.*.*.tidx_blks_read
*.*.postgres.*.*.*.*.database.*.io_table.*.*.*.tidx_blks_hit

metric_pg_stat_all_tables

The pg_stat_all_tables view will contain one row for each table in the current database (including TOAST tables), showing statistics about accesses to that specific table. The pg_stat_user_tables and pg_stat_sys_tables views contain the same information, but filtered to only show user and system tables respectively.

Metric IdtypeDescription
seq_scanBigintNumber of sequential scans initiated on this table. documentation
seq_tup_readBigintNumber of live rows fetched by sequential scans. documentation
idx_scanBigintNumber of index scans initiated on this table. documentation
idx_tup_fetchBigintNumber of live rows fetched by index scans. documentation
n_tup_insBigintNumber of rows inserted. documentation
n_tup_updBigintNumber of rows updated (includes HOT updated rows for < 17 and includes row updates counted in n_tup_hot_upd and n_tup_newpage_upd, and remaining non-HOT updates for ≥ 17). documentation
n_tup_delBigintNumber of rows deleted. documentation
n_tup_hot_updBigintNumber of rows HOT updated (i.e., with no separate index update required). documentation
n_live_tupBigintEstimated number of live rows. documentation
n_dead_tupBigintEstimated number of dead rows. documentation
last_vacuumTimestamp With Time ZoneLast time at which this table was manually vacuumed (not counting VACUUM FULL). documentation
last_autovacuumTimestamp With Time ZoneLast time at which this table was vacuumed by the autovacuum daemon. documentation
last_analyzeTimestamp With Time ZoneLast time at which this table was manually analyzed. documentation
last_autoanalyzeTimestamp With Time ZoneLast time at which this table was analyzed by the autovacuum daemon. documentation
vacuum_countBigintNumber of times this table has been manually vacuumed (not counting VACUUM FULL). documentation
autovacuum_countBigintNumber of times this table has been vacuumed by the autovacuum daemon. documentation
analyze_countBigintNumber of times this table has been manually analyzed. documentation
autoanalyze_countBigintNumber of times this table has been analyzed by the autovacuum daemon. documentation
Metrics
*.*.postgres.*.*.*.*.database.*.table.*.*.*.seq_scan
*.*.postgres.*.*.*.*.database.*.table.*.*.*.seq_tup_read
*.*.postgres.*.*.*.*.database.*.table.*.*.*.idx_scan
*.*.postgres.*.*.*.*.database.*.table.*.*.*.idx_tup_fetch
*.*.postgres.*.*.*.*.database.*.table.*.*.*.n_tup_ins
*.*.postgres.*.*.*.*.database.*.table.*.*.*.n_tup_upd
*.*.postgres.*.*.*.*.database.*.table.*.*.*.n_tup_del
*.*.postgres.*.*.*.*.database.*.table.*.*.*.n_tup_hot_upd
*.*.postgres.*.*.*.*.database.*.table.*.*.*.n_live_tup
*.*.postgres.*.*.*.*.database.*.table.*.*.*.n_dead_tup
*.*.postgres.*.*.*.*.database.*.table.*.*.*.last_vacuum
*.*.postgres.*.*.*.*.database.*.table.*.*.*.last_autovacuum
*.*.postgres.*.*.*.*.database.*.table.*.*.*.last_analyze
*.*.postgres.*.*.*.*.database.*.table.*.*.*.last_autoanalyze
*.*.postgres.*.*.*.*.database.*.table.*.*.*.vacuum_count
*.*.postgres.*.*.*.*.database.*.table.*.*.*.autovacuum_count
*.*.postgres.*.*.*.*.database.*.table.*.*.*.analyze_count
*.*.postgres.*.*.*.*.database.*.table.*.*.*.autoanalyze_count

metric_pg_stat_archiver_table

The pg_stat_archiver view will always have a single row, containing data about the archiver process of the cluster.

Metric IdtypeDescription
failed_countBigintNumber of failed attempts for archiving WAL files. documentation
archived_countTextNumber of WAL files that have been successfully archived. documentation
last_archived_time_in_secondsInteger (seconds)Time of the last successful archive operation. documentation
wal_files_countIntegerAmount of WAL files.
last_archive_successfulBoolean (0 = success/1 = failed)`Indicate if the last archive operation was successful.
Metrics
*.*.postgres.*.*.*.*.stat_archiver.failed_count
*.*.postgres.*.*.*.*.stat_archiver.archived_count
*.*.postgres.*.*.*.*.stat_archiver.last_archived_time_in_seconds
*.*.postgres.*.*.*.*.stat_archiver.wal_files_count
*.*.postgres.*.*.*.*.stat_archiver.last_archive_successful

metric_pg_stat_database

The pg_stat_database view will contain one row for each database in the cluster, showing database-wide statistics.

Metric IdtypeDescriptionVersions
numbackendsIntegerNumber of backends currently connected to this database. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset. documentationall
xact_commitBigintNumber of transactions in this database that have been committed. documentationall
xact_rollbackBigintNumber of transactions in this database that have been rolled back. documentationall
blks_readBigintNumber of disk blocks read in this database. documentationall
blks_hitBigintNumber of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system's file system cache). documentationall
tup_returnedBigintNumber of rows returned by queries in this database. documentationall
tup_fetchedBigintNumber of rows fetched by queries in this database. documentationall
tup_insertedBigintNumber of rows inserted by queries in this database. documentationall
tup_updatedBigintNumber of rows updated by queries in this database. documentationall
tup_deletedBigintNumber of rows deleted by queries in this database. documentationall
conflictsBigintNumber of queries canceled due to conflicts with recovery in this database. (Conflicts occur only on standby servers; see pg_stat_database_conflicts for details.) documentationall
temp_filesBigintNumber of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the log_temp_files setting. documentationall
temp_bytesBigintTotal amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting. documentationall
deadlocksBigintNumber of deadlocks detected in this database. documentationall
blk_read_timeDouble PrecisionTime spent reading data file blocks by backends in this database, in milliseconds. documentationall
blk_write_timeDouble PrecisionTime spent writing data file blocks by backends in this database, in milliseconds. documentationall
session_timeDouble PrecisionTime spent by database sessions in this database, in milliseconds (note that statistics are only updated when the state of a session changes, so if sessions have been idle for a long time, this idle time won't be included).documentation
active_timeDouble PrecisionTime spent executing SQL statements in this database, in milliseconds (this corresponds to the states active and fastpath function call in pg_stat_activity).documentation
idle_in_transaction_timeDouble PrecisionTime spent idling while in a transaction in this database, in milliseconds (this corresponds to the states idle in transaction and idle in transaction (aborted) in pg_stat_activity).documentation
sessionsBigintTotal number of sessions established to this database.documentation
sessions_abandonedBigintNumber of database sessions to this database that were terminated because connection to the client was lost.documentation
sessions_fatalBigintNumber of database sessions to this database that were terminated by fatal errors.documentation
sessions_killedBigintNumber of database sessions to this database that were terminated by operator intervention.documentation
stats_resetTimestamp With Time ZoneTime at which these statistics were last reset. documentation≥ 15
Metrics
*.*.postgres.*.*.*.*.database.*.*.numbackends
*.*.postgres.*.*.*.*.database.*.*.xact_commit
*.*.postgres.*.*.*.*.database.*.*.xact_rollback
*.*.postgres.*.*.*.*.database.*.*.blks_read
*.*.postgres.*.*.*.*.database.*.*.blks_hit
*.*.postgres.*.*.*.*.database.*.*.tup_returned
*.*.postgres.*.*.*.*.database.*.*.tup_fetched
*.*.postgres.*.*.*.*.database.*.*.tup_inserted
*.*.postgres.*.*.*.*.database.*.*.tup_updated
*.*.postgres.*.*.*.*.database.*.*.tup_deleted
*.*.postgres.*.*.*.*.database.*.*.conflicts
*.*.postgres.*.*.*.*.database.*.*.temp_files
*.*.postgres.*.*.*.*.database.*.*.temp_bytes
*.*.postgres.*.*.*.*.database.*.*.deadlocks
*.*.postgres.*.*.*.*.database.*.*.blk_read_time
*.*.postgres.*.*.*.*.database.*.*.blk_write_time
*.*.postgres.*.*.*.*.database.*.*.session_time
*.*.postgres.*.*.*.*.database.*.*.active_time
*.*.postgres.*.*.*.*.database.*.*.idle_in_transaction_time
*.*.postgres.*.*.*.*.database.*.*.sessions
*.*.postgres.*.*.*.*.database.*.*.sessions_abandoned
*.*.postgres.*.*.*.*.database.*.*.sessions_fatal
*.*.postgres.*.*.*.*.database.*.*.sessions_killed
*.*.postgres.*.*.*.*.database.*.*.stats_reset

metric_pg_stat_database_conflicts

The pg_stat_database_conflicts view will contain one row per database, showing database-wide statistics about query cancels occurring due to conflicts with recovery on standby servers. This view will only contain information on standby servers, since conflicts do not occur on master servers.

Metric IdtypeDescription
confl_tablespaceBigintNumber of queries in this database that have been canceled due to dropped tablespaces. documentation
confl_lockBigintNumber of queries in this database that have been canceled due to lock timeouts. documentation
confl_snapshotBigintNumber of queries in this database that have been canceled due to old snapshots. documentation
confl_bufferpinBigintNumber of queries in this database that have been canceled due to pinned buffers. documentation
confl_deadlockBigintNumber of queries in this database that have been canceled due to deadlocks. documentation
Metrics
*.*.postgres.*.*.*.*.conflicts.*.*.confl_tablespace
*.*.postgres.*.*.*.*.conflicts.*.*.confl_lock
*.*.postgres.*.*.*.*.conflicts.*.*.confl_snapshot
*.*.postgres.*.*.*.*.conflicts.*.*.confl_bufferpin
*.*.postgres.*.*.*.*.conflicts.*.*.confl_deadlock

metric_pg_replication

Metric IdtypeDescription
replication.wal_receiver_countIntegerAmount WAL receiver process running the master what sends data to the slave.
replication.wal_sender_countIntegerAmount of WAL sender process that run at the primary node. Each replication has its own.
replication.replication_lagInteger (seconds)Amount of time since the pg_last_xact_replay_timestamp, that is the last transaction replayed during recovery.
replication.replication_slots_countIntegerThe same as pg_replication_slots PostgreSQL property that this view provides a listing of all replication slots that currently exist on the database cluster. documentation
replication.inactive_replication_slots_countIntegerThe amount of replication_slots_count in inactive state.
replication.cluster_replication_slots_countIntegerThe amount of replication_slots_count that marches with the regex /^repmgr_slot_[0-9]+$/.
ha.masterInteger (1 = true/0 = false)If it is a master node.
ha.standbyInteger (1 = true/0 = false)If it is a slave node.
ha.wal_dir_sizeInteger (Bytes)Size of the WAL directory.
Metrics
*.*.postgres.*.*.*.*.replication.wal_receiver_count
*.*.postgres.*.*.*.*.replication.wal_sender_count
*.*.postgres.*.*.*.*.replication.replication_lag
*.*.postgres.*.*.*.*.replication.replication_slots_count
*.*.postgres.*.*.*.*.replication.inactive_replication_slots_count
*.*.postgres.*.*.*.*.replication.cluster_replication_slots_count
*.*.postgres.*.*.*.*.ha.master
*.*.postgres.*.*.*.*.ha.standby
*.*.postgres.*.*.*.*.ha.wal_dir_size

metric_pg_node_status

*.*.postgres.*.*.*.*.postgresql_info_status.blocked

Description of Metrics:

postgresql_info_status.blocked indicates if any of the nodes has blocked status that means that this node doesn't participate in cluster life. This metric can be equal:

  • 1 - blocked
  • 0 - unblocked

Configuring metrics databases

By setting the metric_databases custom parameter on a Service Instance it is possible to control which database metrics are generated. The metric_databases parameter expects an array of database names. If the parameter is not set or the array is set to empty, then metrics will be collected for all databases.

PostgreSQL Extensions

Create or Drop Extensions

It is possible to install PostgreSQL extensions with the Cloud Foundry CLI and additional configuration parameters:

Commands
cf create-service a9s-postgresql PLAN_NAME INSTANCE_NAME -c '{"install_plugins": ["<plugin_name>"]}'
cf update-service INSTANCE_NAME -c '{"install_plugins": ["<plugin_name>"]}'
cf update-service INSTANCE_NAME -c '{"delete_plugins": ["<plugin_name>"]}'

Available Extensions

The following PostgreSQL extensions are available:

  • postgis
  • uuid-ossp
  • ltree
  • pgcrypto
  • citext
  • pg_stat_statements
  • fuzzystrmatch
  • pg_trgm
  • hstore
  • vector

Default Extensions

There are PostgreSQL extensions that are always installed and it's also not possible to delete them. The following PostgreSQL extensions are set as default extensions:

  • pgcrypto
  • citext

These two extensions are needed to have a functional replication.

PostgreSQL statistics collector

You can enable support for the statistics collector feature (please note that this feature is PostgreSQL version specific). This feature allows you to retrieve information about the current status of the PostgreSQL cluster. It includes information about currently active queries and other useful informations. For each statistics collector view another one is created by a PostgreSQL super user (with the super users' access privileges) that has the same name with a prefix prepended.

Example: For pg_stat_activity the associated view is called ds_pg_stat_activity. You can set the value of the prefix as you prefer. Read-only access to the views created by this feature is given to every user allowed to login on the cluster via the public schema.

You need to connect to the postgres database with your service bindings in order to use those views.

This feature is disabled by default. You can ask your Platform Operator to enable this feature for your Service Instance.

Enable AppDynamics support

Enable AppDynamics support to create a view called pg_stat_activity_allusers which is accessible to all users as described here.

This feature is disabled by default. You can ask your Platform Operator to enable this feature for your Service Instance.