Python.d/postgres plugin: add pg_stat_statements metrics for monitoring database queries

Problem/Question

I experiment with the addition of pg_stat_statements metrics to monitor queries to PostgreSQL in Netdata (python.d/postgres plugin), and I have some difficulties with adding the new charts.

In fact, I can now add Top-1 metrics (e.g., max total time)

But I have a questions:

  1. How to add a queryid to a chart?
  2. How to add multiple values in chart for each queryid?

Here are the changes that I made in postgres.chart.py:

I am not strong in programming on Python, so I will be glad to any help in this matter.

What I expected to happen

Add stat_statements charts with multiple values for each queryid.

Example:

How is the progress of this feature? It would be really useful for our project. Even just the Top-1 metrics would be more than enough for us.
Unfortunately I can’t really help you with the question but couldn’t you take inspiration from existing collectors that does the same thing like the Applications > CPU chart?

Hello, guys. Somehow I missed this topic :man_shrugging: @Vitaliy_Kukharik my suggestion is to create a PR with your changes. I have no real experience with Postgres, but I can tag some people on GitHub who has.

As for a chart with queryid dimensions - I understand that we need to add a dimension to the chart is there is a new entry in that table. But do we need to remove them?