pgpro-otel-collector

pgpro-otel-collector (Postgres Pro OpenTelemetry Collector) is an independent utility designed to collect and process statistical data from database instances, such as metrics and activity logs, and deliver it to monitoring systems compatible with OpenTelemetry. It functions as an agent or middleware between the database and the monitoring system.

Overview

A single instance of Postgres Pro generates a significant amount of statistical data, which is stored in system views, tables, and catalogs. Another source of data is activity logs (error logs, slow query logs, etc.), stored as files. To utilize this data, it must be extracted and sent to monitoring systems equipped with advanced tools such as visualization charts, dashboards, alerting tools, reports, and anomaly detection.

After collecting the data, pgpro-otel-collector converts it into a format compatible with various monitoring systems. Depending on the data transfer model, the converted data is either published on the collector side (pull model), or sent to a particular monitoring system (push model). Once stored in the monitoring system, the data becomes available for further analysis and visualization.

pgpro-otel-collector can be used as an alternative to traditional PostgreSQL monitoring agents, such as Postgres Exporter, or Zabbix Agent.

Architecture

pgpro-otel-collector is based on the OpenTelemetry Collector and consists of several components that work together in a pipeline:

Plugins

Plugins are internal components of a receiver responsible for collecting various types of statistical data. Each plugin is designed to collect specific information, which is then converted into metric groups. pgpro-otel-collector provides metric groups that describe various subsystems, events, and processes within the database management system (DBMS), such as table and index usage, background processes, resource usage by queries, and more.

The amount of statistical data may vary depending on the Postgres Pro version and edition. This adds up to variability and complexity of collection methods. Another important role of pgpro-otel-collector is to abstract these differences from monitoring systems while providing comprehensive information about the database.

The postgrespro receiver includes the following plugins:

Each of these plugins can provide dozens of types of metrics. Depending on the number of objects in the instance, there may be thousands of metrics. However, some metrics or even metric groups may not be needed. Therefore, pgpro-otel-collector allows for the disabling of selected plugins, enabling control over the amount and quality of collected data.

Requirements and Limitations

For pgpro-otel-collector to operate correctly, the following requirements should be met:

Note that at the moment, a single instance of pgpro-otel-collector supports data collection from a single database instance only.

Compatibility

pgpro-otel-collector supports the following PostgreSQL and Postgres Pro versions and editions:

Installation and Setup

  1. pgpro-otel-collector is installed from the Postgres Pro software repository. To install the repository, download and run the script pgpro-repo-add.sh.
  2. Once Postgres Pro repositories are installed and configured, update the package manager metadata and install the pgpro-otel-collector package.

Example for Debian/Ubuntu Linux distributions:

# wget https://repo.postgrespro.ru/otelcol/otelcol/keys/pgpro-repo-add.sh
# sh ./pgpro-repo-add.sh
# apt update
# apt install pgpro-otel-collector
  1. After pgpro-otel-collector is installed, ensure that the configuration file /etc/pgpro-otel-collector/basic.yml contains valid connection parameters and the required set of plugins. Then start pgpro-otel-collector:
# systemctl start pgpro-otel-collector

pgpro-otel-collector will automatically start collecting and sending data according to the settings in the configuration file.

Configuration Parameters

The main configuration file is located in /etc/pgpro-otel-collector/basic.yml and is used by default. The file contains settings for pgpro-otel-collector internal components and a minimal set of plugins. It is assumed that with this minimal set, pgpro-otel-collector will always be able to collect information from any supported version of Postgres Pro. In the directory /usr/share/doc/pgpro-otel-collector/examples, you can find additional configuration files to enable other plugins. Before enabling any plugins, ensure that statistics are available on the database instance side. Note that enabling extra plugins can lead to high overhead (data collection costs) and should be considered carefully.

The postgrespro Receiver Settings

The postgrespro receiver settings can be divided into the following groups:

The otlphttp Exporter Settings

The otlphttp exporter is not used by default, because it requires additional configuration like specifying the monitoring system address where the information should be sent.

Service Settings

Services are the internal parts of pgpro-otel-collector responsible for its internal functions. pgpro-otel-collector uses the following services:

Troubleshooting

Use the below commands to display system details.

# systemctl status pgpro-otel-collector
# journalctl -u pgpro-otel-collector

Logging level can be controlled by the service.telemetry.logs.level parameter and can take the following values: debug, info (default), warn, error.