postgresml/pgcat

Feature request: per-statement-type counters

Opened this issue · 0 comments

Is your feature request related to a problem? Please describe.

A minor blocker for us in considering migrating to pgcat from pgpool-II is that pgpool exposes per-backend counters for statement types, e.g. SELECT, INSERT, UPDATE etc, and we have built a number of dashboards and alerting policies based on this, especially for detection of routing issues and badly formed queries.

https://www.pgpool.net/docs/43/en/html/sql-show-pool-backend-stats.html

Describe the solution you'd like

I think the obvious way to approach this would be to add a type label to the servers_query_count metric, populating it with the statement type.

As a sidebar here: servers_query_count is defined as a gauge in https://github.com/postgresml/pgcat/blob/main/src/prometheus.rs#L133-L136 which seems wrong? At the very least the help text should probably explain why a metric named foo_count is not of a counter type.