3.1. Configuration and Access Privileges #
For pgpro-otel-collector to operate correctly, the following requirements should be met:
pgpro-otel-collector must be able to connect to a Postgres Pro instance. Connection parameters are defined in the configuration file and can be modified as needed.
The user connecting to the DBMS must have relevant rights and access to internal activity statistics.
Privileged access (root) to the
procfsfile system may be required for operating system metric collection by thehostmetricsreceiver. For example, such access is specifically required by the process plugin.Collecting DBMS instance activity logs with the
filelogreceiver requires access to the relevant directories and log files.
The plugins listed below require additional configuration or access privileges. Make sure you complete the specified steps.
Note
All access privileges must be granted to the user under which pgpro-otel-collector runs and collects metrics (otelcol in this documentation). For more information on how to set up a DBMS user, refer to Section 6.6.2.1.
For bloat_indexes, run this command in all target databases:
GRANT SELECT ON pg_statistic TO otelcol;
On large databases, the bloat_indexes and bloat_tables plugins may cause significant response delays during initial data collection. To mitigate this, the fetcher process can be set up for background data loading in custom-sized batches.
Example of the fetcher configuration for bloat_tables:
bloat_tables: enabled: true collection_interval: 5m fetcher: # Whether to delay metric availability until initial data loading completes. wait_init: false # Enable detailed logging for debugging purposes. extended_log_enabled: false # Number of records to fetch in each batch. batch_size: 10000For the bloat_tables, cfs, tables, and indexes plugins, execute the following command for all collected schemas:
GRANT USAGE ON SCHEMA
schema_nameTO otelcol;buffercache requires additional setup:
Install the pg_buffercache extension by adding
pg_buffercacheto theshared_preload_librariesvariable in thepostgresql.conffile.Restart the DBMS server.
Run this command in all target databases:
CREATE EXTENSION pg_buffercache;
Execute the following command:
GRANT pg_monitor TO otelcol;
For databases, the DBMS user must have permission to execute the
pg_ls_dirandpg_stat_filefunctions for all target databases to collect data from orphaned files:GRANT EXECUTE ON FUNCTION pg_ls_dir(text) TO otelcol; GRANT EXECUTE ON FUNCTION pg_ls_dir(text,boolean,boolean) TO otelcol; GRANT EXECUTE ON FUNCTION pg_stat_file(text) TO otelcol;
statements_* requires additional setup:
Install the pg_stat_statements extension by adding
pg_stat_statementsto theshared_preload_librariesvariable in thepostgresql.conffile.Restart the DBMS server.
Run this command in all target databases:
CREATE EXTENSION pg_stat_statements;
Execute the following command:
GRANT pg_monitor TO otelcol;
For tablespaces, run this command:
GRANT pg_monitor TO otelcol;
wait_sampling requires additional setup:
Install the pg_wait_sampling extension by adding
pg_wait_samplingto theshared_preload_librariesvariable in thepostgresql.conffile.Restart the DBMS server.
Run this command in all target databases:
CREATE EXTENSION pg_wait_sampling;