postgres_exporter
postgres_exporter copied to clipboard
Add the type of statement (`SELECT|INSERT|UPDATE|DELETE`) as a label in the `stat_statements` collector
Proposal
Use case. Why is this important?
My database enjoys/suffers heavy read+write traffic with the writes dominating the load, sometimes by orders of magnitude. That makes it very difficult to track the performance of the read queries, even when one uses a logarithmic scale on Grafana. The read (SELECT) queries are simply very close to the bottom and only if you manually hide many write (INSERT) queries, the dashboard becomes usable.
If postgres_exporter would add yet another label to the metrics exported from the pg_stat_statements
view, it would be much easier to filter out the write queries. The label would need to contain the type of statement: INSERT/UPDATE/DELETE/CREATE/ALTER/SELECT/OTHER
.
Even if postgres_exporter did something really simple (like taking the first word from the query
column, without really parsing the SQL) it would help a lot already.