prometheus-community / postgres_exporter

A PostgreSQL metric exporter for Prometheus
Apache License 2.0
2.83k stars 746 forks source link

Support for default DSN #382

Open akamensky opened 4 years ago

akamensky commented 4 years ago

100% of tools use default DSN VERY different from what postgres_exporter is trying to use.

It should be using local socket file, w/o password relying on ident authentication. By default it is trying to use some password, whereas postgres default way for authentication is passwordless ident.

akamensky commented 4 years ago

It appears to iterate through the list of "default" dsns, which is so wrong in my opinion. There should be only one default DSN, if that does not work it should fail. Otherwise with it iterating over a list to find the one that works I end up on situation where one scrape takes 5 seconds, and my goal is to scrape every second.

akamensky commented 4 years ago

Also it appears to open and close postgres connection for every scrape, that is pretty bad, it will be very slow.

akamensky commented 4 years ago

FFFFFFFFF, it is just broken. I provided UNIX SOCKET DSN, with --auto-discover-databases it tries to connect to every discovered DB over TCP, which fails.

frittentheke commented 4 years ago

@akamensky there already is a PR potentially fixing this ... https://github.com/wrouesnel/postgres_exporter/pull/366