Configuring collecting from specific databases - CHERTS/pgscv GitHub Wiki

Configuring collecting metrics from specific databases.

In general, Postgres provides shared and pre-databases stats. Shared stats describe Postgres subsystem and available from any database, e.g. bgwriter, activity or databases stats. Per databases stats describe stats about objects belong to particular database and available only in single database scope, e.g. tables, indexes, functions stats. For collecting per-database stats it is required to connect to every interesting database.

By default, pgSCV collects shared stats from the first connected database, all per-database stats are collected from the rest of databases. Such approach might lead to generating a huge amount of metrics in case of many databases, tables, indexes or functions inside the cluster.

For limiting collecting metrics only from specific databases use databases parameter in YAML configuration:

databases: "^[a-z_]+_prod$"

This is root-level parameter contains regular expression. The expression describes which databases should be visited for collecting metrics. This parameter takes effect only in case of builtin metrics. User-defined metrics are collected with a different logic and use its own settings.

Builtin metrics - empty databases (default) means collect builtin metrics from all discovered databases. If user wants to limit collecting, he has to specify exact databases.

User-defined metrics - empty databases (default) means collect builtin metrics from first connected database. If user wants to collect metrics from many databases, he has to specify exact databases.