Skip to content

Close DB connection after probe completes. #734

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

Merged
merged 1 commit into from
Feb 12, 2023

Conversation

kjbass
Copy link
Contributor

@kjbass kjbass commented Dec 14, 2022

Currently each probe creates a new DB connection which is never closed. This fix closes the connection upon the completion of a probe. An alternative solution would be to inject a DB object into the handleProbe handler, but that would be a larger scope change.

Tested locally and scrapes correctly without increasing the number of connections in Postgres.

edit: since opening the PR I have been running this in a dev environment and scrapes are working as expected and connection level is staying stable.

Will fix #727

Signed-off-by: Kurtis Bass [email protected]

@nthienan
Copy link

Can anybody process this pr?

@nthienan
Copy link

@SuperQ Can you help to review this?

Copy link
Contributor

@sysadmind sysadmind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks!

@sysadmind sysadmind merged commit 94a89b0 into prometheus-community:master Feb 12, 2023
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 this pull request may close these issues.

postgres_exporter left more and more conntions in database and not released or reuse them
3 participants