For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

Metrics

The Cennso Database extension uses the Prometheus PostgreSQL exporterOpens in a new tab to collect and expose metrics from deployed PostgreSQL database instances.

The postgres_exporter provides different metric collectors, each responsible for gathering specific categories of data. By default, the following collectors are enabled by the exporter:

  • database - collects database sizes
  • database_wraparound - collects the transaction ID age of each database
  • extensions - collects information about the installed extensions
  • locks - collects the number of locks per database and lock mode
  • postmaster - collects the start time of the PostgreSQL server
  • replication - collects replication lag and role information
  • replication_slot - collects replication slot status and WAL positions
  • stat_bgwriter - collects background writer and checkpoint statistics
  • stat_database - collects database-wide statistics, such as transactions, block reads, and tuple operations
  • stat_user_tables - collects table statistics, such as scans, tuple operations, and vacuum runs
  • statio_user_tables - collects table I/O statistics

In addition to the collectors enabled by the exporter, the postmaster collector is enabled by the Cennso Database extension. The Grafana dashboard uses it to show the uptime of the PostgreSQL instances. The other collectors are enabled by default in postgres_exporter.

Note

The postgres_exporter connects to the postgres database, so the stat_user_tables and statio_user_tables collectors report only the tables of the postgres database.

The stat_statements collector requires the pg_stat_statements extension and creates metrics for every distinct statement. Use the statements by type metrics instead.

You can enable or disable any collector using the spec.metricsExporter.collectors configuration option, for example replication_slot: false. The collectors that you do not set keep their default state. The Grafana dashboard requires the following collectrs:

  • database
  • database_wraparound
  • locks
  • postmaster
  • replication
  • stat_bgwriter
  • stat_database

Disabling any of these collectors leaves some dashboard panels empty.

For a complete list of available collectors and their descriptions, see the flags documentationOpens in a new tab in the postgres_exporter repository.

For more information on how to enable and configure the metrics collector, see the Enable metrics collector deployment guide.

Statements by type

If the pg_stat_statements extension is enabled with the spec.postgresql.extensions.pgStatStatements.enabled configuration option, the postgres_exporter exposes the following metrics:

Each metric has the command label with the statement type, which is the first word of the statement in lowercase, for example select, insert, update, delete, begin, or commit. The metrics cover the statements of all databases of the PostgreSQL instance. Statements executed inside functions are not counted separately.

These metrics are not shown in the Grafana dashboard. You can add them to the dashboard using the following promqlOpens in a new tab queries:

  • Statements per second:

    promql
  • Rows per second:

    promql
  • Execution time per second. A value of 2 means that, on average, two statements of this type were running at any moment:

    promql

For more information about the limitations of these metrics, see the PostgreSQL extensions section.

Grafana dashboard

The Cennso Database extension provides a default Grafana dashboard that visualizes the collected metrics. For more information about the available dashboard panels and their interpretation, see the Grafana dashboard document.