5.16. Metrics #

Key performance indicators of the system can be monitored using graphs based on metrics collected by pgpro-otel-collector. For the graphs to work properly, you must first install and configure logging and monitoring tools.

You can also access SQL metrics that are provided based on planning statistics and SQL statement execution statistics collected by the pgpro_stats extension.

Important

When creating SQL metrics use queries with aggregate functions, such as COUNT, SUM, and AVG. The instance can fail when using metrics based on queries returning more than one row or separate values, for example, SELECT 1.

Viewing Main Metrics

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click the name of the instance.

  3. In the navigation panel, go to Metrics.

The following graphs will be displayed:

SQL Metrics #

This section explains how to manage SQL metrics. It contains the following instructions:

Creating an SQL Metric

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click the name of the instance.

  3. In the navigation panel, go to MetricsSQL metrics.

  4. In the top-right corner of the page, click Add SQL metric.

  5. Enter parameters of the new SQL metric (parameters marked with an asterisk are required):

    • Name.

    • Database: The database where the query will be executed.

    • User: The system role on behalf of which the query will be executed.

    • Collection interval: The frequency of data collection.

    • Query: The SQL query based on which the metric is computed.

      Important

      Use queries with aggregate functions, such as COUNT, SUM, and AVG. The instance can fail when using metrics based on queries returning more than one row or separate values, for example, SELECT 1.

    • Instance restart is required: Specifies whether to restart the instance.

  6. Click Add.

Viewing SQL Metrics

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click the name of the instance.

  3. In the navigation panel, go to MetricsSQL metrics.

The table of SQL metrics with the following columns will be displayed:

  • ID.

  • Name.

  • Database: The database where the query is executed.

  • User: The system role on behalf of which the query will be executed.

  • Interval: The frequency of data collection.

  • Last value: The result of the last query in the JSON format.

  • Updated at: The time the data was last updated.

  • Query: The SQL query based on which the metric is computed.

  • Actions.

    For more information about available actions, refer to other instructions in this section.

To view the history of collected data, click the metric name.

Editing an SQL Metric

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click the name of the instance.

  3. In the navigation panel, go to MetricsSQL metrics.

  4. Click Edit next to the SQL metric.

  5. Edit SQL metric parameters.

  6. Click Save.

Deleting an SQL Metric

Important

Deleted SQL metrics cannot be restored.

To delete an SQL metric:

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click the name of the instance.

  3. In the navigation panel, go to MetricsSQL metrics.

  4. Click Delete next to the SQL metric.

  5. Click Delete.