1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2025-11-03 07:53:12 +03:00

Adjust collector to use separate connection per scrape (#931)

Fixes #921

Signed-off-by: Joe Adams <github@joeadams.io>
This commit is contained in:
Joe Adams
2023-10-10 07:07:37 -04:00
committed by GitHub
parent f0f051cb9a
commit 2a5692c028
2 changed files with 13 additions and 3 deletions

View File

@@ -43,6 +43,13 @@ func newInstance(dsn string) (*instance, error) {
return i, nil
}
// copy returns a copy of the instance.
func (i *instance) copy() *instance {
return &instance{
dsn: i.dsn,
}
}
func (i *instance) setup() error {
db, err := sql.Open("postgres", i.dsn)
if err != nil {