Skip to content

Adding connection limit stats for database and roles #996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jocelynthode opened this issue Jan 15, 2024 · 2 comments · Fixed by #997
Closed

Adding connection limit stats for database and roles #996

jocelynthode opened this issue Jan 15, 2024 · 2 comments · Fixed by #997

Comments

@jocelynthode
Copy link
Contributor

Proposal

Hey, at my company we're relying heavily on the postgres_exporter to monitor our PostgreSQL instances and we recently faced the issues where a project used all their alloted connections defined by a connection limit on the database and we had no way of seeing it in our Prometheus/Alertmanager setup.

I would like to contribute a collector to retrieve both the pg_database_connection_limits and pg_roles_connection_limits. Is this a feature the project would be interested? If yes I'll happily open a PR with these changes. (I already have an initial working code with no tests)

@SuperQ
Copy link
Contributor

SuperQ commented Jan 15, 2024

Yes, that sounds like perfectly reasonable collectors. Can you document what queries are required for this info?

One thing I'm working towards is consolidating similar collectors.

@jocelynthode
Copy link
Contributor Author

Here are the required queries:

  • As we filter database I have to do it one by one as we do for the database size select pg_database.datconnlimit FROM pg_database WHERE pg_database.datname = $1
  • select pg_roles.rolname,pg_roles.rolconnlimit FROM pg_roles

I should have a PR ready either today or by the end of the week. It might be a WIP as I'm not familiar with the code base :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants